Power features like "Similar products..." and "Users also liked..."

Our vector powered recommendations helps you build features like:

  • "Similar to..."
  • "Other users liked..."
  • "You might like..."

Start by creating vector fields

Vectors are an AI data format which you can create based on your text or image URL fields. These are what we use to make recommendations based on.

Learn about how to vectorize your data.

Recommend with likes and dislikes

Our recommendation API works by being fed the _id's of documents that the user has indicated they liked or disliked. How these ids are determined is up to you and your application!

Some common examples of determining positive/negative ids:

  • Feeding in a single positive_id of the current document they are viewing (for example, the product from a product page) and finding similar documents based on that

  • Feeding in a list of "liked" or "disliked" document ids from the user that you have stored in a separate database or dataset (for example, on a social media feed like Instagram)

  • Feeding in a list of "previously purchased" document _ids that you have stored in your ecommerce solution as positive_id's

  • Feeding in a list of previously viewed documents as positive_id's, to deliver a feature like "Based on your viewing history"

You're even able to weight the different _id's individually, to handle situations such as user ratings.

Here's an example where we want to weight the positive_ids based on a rating the user gave them:

const reviewedMoviesIds = [
    _id: 1,
    rating: 3
    _id: 2,
    rating: 8
    _id: 3,
    rating: 9
    _id: 4,
    rating: 8
    _id: 5,
    rating: 1

// let's say ratings over 6 are "positive" and ratings below 4 are "negative"
const positivelyReviewedMovies = reviewedMovies.filter(movie => movie.rating > 6);
const negativelyReviewedMovies = reviewedMovies.filter(movie => movie.rating < 4);

// create a key-value object where the key is the _id and value is a weighting
const positive_ids = positivelyReviewedMovies.reduce((accumulator, movie) => {
  // the ratings are out of 10
    accumulator[movie._id] = movie.rating/10;
    return acummulator;
}, {});

// no weightings needed here for negatively rated movies, but you could!
const negative_ids = negativelyReviewedMovies.map(movie => movie._id);

// generate recommendations based off the short description meaning
const recommendationPayload = {
  vector_fields: [ 'short_description_vector_' ]