Guides / Algolia Recommend

Algolia Recommend lets you display recommendations on your website. Recommendations encourage users to expand their search and browse more broadly. If an item isn’t exactly what users are looking for, they can quickly jump to similar or complementing items.

How Recommend works

Under the hood, recommendations rely on supervised machine learning models and the Algolia foundation.

There are two different flavors of recommendation algorithms.

Collaborative filtering works by analyzing user events. First, the user events from the last 30 to 90 days are collected. Recommend builds a table with userToken as columns and objectID as rows. Each cell represents the number of interactions between a userToken and an objectID. Then, Recommend analyzes the table with a collaborative filtering algorithm. For each item, the algorithm finds other items that share similar buying patterns across users. Items are considered similar if the same set of users interacted with them. Items would be considered 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, the trained model recommends other objectIDs that are related, based on the characteristic model. The former is called the source item or viewed item, and the latter the recommendations.

Frequently Bought Together

Frequently Bought Together recommends items that are often bought together. To find such items, Recommend looks at conversion events, which are events towards a goal, for example, a purchase. Two or more items are considered bought together if the same user performs conversions with these items on the same day.

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

By using content-based filtering you will be able to show related content instead of related products.

Content-based filtering creates even more relevant recommendations compared to just relying on collaborative filtering, and also allows you to show recommendations when you didn’t collect enough user events yet. With content-based filtering you can maximize your catalog exposure, so that your users get relevant recommendations even on items that aren’t popular.

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

The Trending Items model looks for items in your product catalog that saw a recent increase in popularity based on conversion events. Trends can be global, for example, recommend trending items in your entire product catalog. Trends can also be within a specific facet or category, for example, recommend trending winter sweaters.

The Trending Facet Values model looks for facet values that recently increased in popularity. For example, you can recommend trending categories (facet values) for the facet “categories”.

You can use both models together. For example, on your home page, you can show trending categories in a carousel layout. In each card of the carousel, you can show the trending items for each category.

Events requirements for the models

Each model requires a minimum number of events or items with attributes to create relevant recommendations. 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. The Trending Items and Trending Facet Values models only collect events from the last 30 days.

Each model also has a maximum number of events it considers for training. Any additional events or items with attributes are ignored. The models only generate recommendations for the items found within these limits.

All models generate 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 attributes 10 1,500,000
Trending Items conversion events 500 3,000,000
Trending Facet Values conversion events 500 3,000,000

Migrating from the Recommend beta

Since June 30, 2021, Algolia Recommend is generally available. You can 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 don’t receive any updates since 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 front end, see the Recommend API reference for more information about the returned response.

Did you find this page helpful?