Guides / Algolia Recommend

Algolia Recommend lets you display recommendations on your website. Recommendations encourage users to expand their search and browse more broadly. Users can jump to similar or complementary items if they don’t find a precise match.

How Recommend works

Recommendations rely on supervised machine learning models that are trained on your product data and user interactions.

Recommend uses two different algorithm types: collaborative filtering and content-based filtering.

  • Collaborative filtering analyzes user events from the last 30-90 days. Recommend creates a table of userToken and objectID which show how many times each user interacted with each record (object). Recommend then uses a collaborative filtering algorithm to find other records that are similar or frequently bought together:
    • Similar if the same set of users interacts with them.
    • Frequently bought together if the same set of users bought them.
  • Content-based filtering analyzes key attributes of items, such as their titles or descriptions, to find similarities.

Recommend models

Algolia Recommend builds models from your index and user events, based on supervised machine learning algorithms. Given an objectID(source item or viewed item), the trained model recommends other related objectIDs (recommendations).

Frequently Bought Together

The Frequently Bought Together model recommends items that are likely to be bought together. To find such items, it looks at conversion events, such as a purchase. If the same user buys two or more items on the same day, they are considered as being bought together. The model uses this information, including historical purchases, to suggest items likely to go well together.

The Related Products and Related Content models recommend items that are related to each other based on:

  • User interactions (click and conversion events) (collaborative filtering)
  • Attributes (content-based filtering). With content-based filtering, you can show related content instead of related products.

Content-based filtering creates even more relevant recommendations than relying on collaborative filtering alone and allows you to show recommendations when you don’t have enough click and conversion events. With content-based filtering, you can maximize your catalog exposure so that users get relevant recommendations even on items that aren’t popular.

If you use content-based and collaborative filtering models, you’ll get a merged set of recommendations from both models.

The Trending Items model looks for items in your product catalog that have recently become popular (based on conversion events). This could be global for the entire catalog or within a specific facet (category), like winter sweaters. The Trending Facet Values model looks for facet values that recently increased in popularity. For example, you can recommend trending facet values within the “categories” facet.

You can use both models together. For example, by showing trending categories on your home page in a carousel layout and in each carousel card, showing the trending items for each category.

Looking Similar

The Looking Similar model recommends items that are related to each other based on the images provided in your index. This model can be set up in a few minutes as it doesn’t require any events.

Events requirements for the models

To create relevant recommendations, each model needs a minimum number of events or items with attributes. If the data collected from the last 30 days isn’t enough, the Frequently Bought Together and Related Products models extend the collection period to 90 days. Similarly, the Trending Items and Trending Facet Values models initially gather data from the preceding 15 days and expand to the last 30 days if needed.

Each model also has a maximum number of events it can use for training. If there are too many events or items with attributes, the model will ignore them.

Each model generates up to 30 recommendations.

Model Input type Minimum number Maximum number
Frequently Bought Together Conversion events with two or more items 1,000 3,000,000
Related Products Click and conversion events 10,000 3,000,000
Related Content Items with values in their content-based attributes 10 1,500,000
Trending Items Conversion events 250 3,000,000
Trending Facet Values Conversion events 250 3,000,000

Event customisation for Frequently Bought Together

By default, the Frequently Bought Together model uses every available and future conversion event for training. However, it can sometimes be helpful to customize the events used to train the model. For instance, to prevent the model from using false positives in its training. Users might interact with items in different ways. For example, they may add several headphones to their cart but buy just one pair. Customizing which events to use can lead to better relevance but can be more challenging in terms of event volume.

For better relevance, you should only select purchase events,so that the model just looks at items that have actually been bought together, instead of “added to cart” or other conversion events you may have.

This process ensures that, instead of using all current and future conversion events for training, the model only uses the events you select. You can always revert to using all events by restoring the default settings.

Training frequency

Once you’ve set up a model for the first time, it will undergo training. After this initial training, models are re-trained once every day (you can’t change how often the model is trained). This ensures your recommendations stay up-to-date as your catalog changes over time.

The training process can start at any moment during the day. Determining how long it will take is impossible because it depends on your catalog size and the resources available.

Migrating from the Recommend beta

Algolia Recommend has been available since June 30, 2021. If you’re using a Recommend beta, you should migrate your beta indices and update your user interface.

Storage and format

In the beta, recommendations were stored in an Algolia index with the following naming convention: ai_recommend_${modelName}_${indexName}.

For example:

  • ai_recommend_bought-together_mysourceindex
  • ai_recommend_related-products_mysourceindex

These beta indices were last updated on August 30, 2021.

After migrating your recommendations, you can delete the indices from the Recommend beta.

Updating your user interface

If you used the Recommendations React component in the beta, see the upgrade guide for more information about updating to the latest Recommend UI library.

If you developed a custom component to show recommendations in your frontend, see the Recommend API reference for more information about the returned response.

Further reading

Did you find this page helpful?