Associate a Product Recommendations Model With a Query Pipeline

When a Coveo Machine Learning (Coveo ML) Product Recommendations (PR) model has been created, it must be associated with a query pipeline to be effective in a search interface.

Organization members with the required privileges can access the Machine Learning tab of a query pipeline configuration page to manage Coveo ML model associations for that query pipeline.

Leading Practices

Plan the Usage of Custom Contexts

While the various Coveo ML features can perform well without custom context information, using custom contexts can take Coveo ML relevance one step further.

You can define custom contexts and then pass appropriate ones along with usage analytics events and queries to allow Coveo ML to take them into account.

Note

If you’re just getting started with Coveo ML, you can skip this step to take advantage of Coveo ML features more quickly and easily, and consider using custom contexts in a second phase.

Associate a PR Model

Important

Follow the model association leading practices when associating your model with your query pipeline.

Note

When using a Coveo Headless library, ensure your query pipeline has the following condition: Recommendation is not empty.

  1. On the Query Pipelines (platform-eu | platform-au) page, click the query pipeline for which you want to associate a PR model, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab, and then in the upper-right corner, click Associate Model.

  3. In the Model drop-down menu, select the desired model.

  4. On the right side, under Condition, you can optionally select a query pipeline condition in the drop-down menu or create a new one.

  5. In the Advanced Configuration section, select the appropriate model strategy. Other association strategies are available when you associate your model via a JSON configuration.

  6. Click Associate Model.

Note

If you are using more than one strategy, you should repeat this process with the appropriate models and conditions.

Edit a PR Model Association

Important

Follow the model association leading practices when associating your model with your query pipeline.

Note

When using a Coveo Headless library, ensure your query pipeline has the following condition: Recommendation is not empty.

  1. On the Query Pipelines (platform-eu | platform-au) page, click the query pipeline for which you want to edit a model association, and then click Edit components in the Action bar.

  2. On the subpage that opens, click the desired model, and then click Edit in the Action bar.

  3. On the right side, under Condition, you can optionally select a query pipeline condition in the drop-down menu or create a new one.

  4. In the Advanced Configuration section, select the appropriate model strategy. Other association strategies are available when you associate your model via a JSON configuration.

  5. Click Save.

Associate a PR Model via a JSON Configuration

Advanced users may want to manage a model association via a JSON configuration to specify association parameters that don’t fit with the parameters available in the Administration Console.

  1. On the Query Pipelines (platform-eu | platform-au) page, click the query pipeline for which you want to associate a model, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab, and then in the upper-right corner, click menu-button, and select Associate a model in JSON view.

  3. On the Associate a Model subpage, in JSON view, replace the <Model_ID> placeholder with the actual ID of the model you want to associate with the pipeline (see Review Coveo Machine Learning Information).

    Note

    Once you have accessed the Associate a Model subpage in JSON view:

    • You can always go back to the Associate a Model subpage in the UI view and use the available options. However, all unsaved changes made in the Associate a Model subpage in JSON view will be lost.

    • The Associate a Model subpage in JSON view becomes the default model association view for that model. In other words, the Associate a Model subpage in JSON view is now automatically displayed when you access this model association.

  4. Click Associate Model.

Edit a PR Model Association via a JSON Configuration

Advanced users may want to manage a model association via a JSON configuration to specify association parameters that don’t fit with the parameters available in the Administration Console.

  1. On the Query Pipelines (platform-eu | platform-au) page, click the query pipeline for which you want to edit a model association, and then click Edit components in the Action bar.

  2. In the Machine Learning tab, click the desired model, and then click Edit in the Action bar.

  3. On the Edit a Model Association subpage, click menu-button, and then select Switch to JSON view.

  4. On the Switch to JSON view? panel that appears, click Switch to JSON view.

    Important

    Switching to the JSON view of the Edit a Model Association subpage cancels unsaved configuration changes made on the Model Association page.

  5. On the Edit a Model Association subpage, in JSON view, tune the JSON model association configuration as needed (see Model Association Parameters).

    Note

    Once you have accessed the Associate a Model subpage in JSON view:

    • You can always go back to the Edit a Model Association subpage in the UI view and use the available options. However, all unsaved changes made in the Associate a Model subpage in JSON view will be lost.

    • If you specified non-default parameters in JSON view of the Edit a Model Association subpage, the complete configuration will be reset to the default one when switching back to the UI view of the Edit a Model Association subpage.

    • The Edit a Model Association subpage in JSON view becomes the default model association view for that model. In other words, the Edit a Model Association subpage in JSON view is now automatically displayed when you access this model association.

  6. Click Save.

Dissociate a Model

  1. On the Query Pipelines (platform-eu | platform-au) page, click the query pipeline from which you want to dissociate a model, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab.

  3. In the Machine Learning tab, click the model you want to dissociate from the pipeline, and then click Dissociate in the Action bar.

The model is now dissociated from the pipeline.

Reorder Model Associations

The Coveo ML models of a given type are executed in the order in which they appear in the page until a condition is satisfied.

Important

The first model on the list will be used if no conditions are met.

  1. On the Query Pipelines (platform-eu | platform-au) page, click the query pipeline in which you want to reorder model associations, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab.

  3. In the Machine Learning tab of the desired query pipeline, click the model whose position you want to change, and then use the Move up or Move down arrows in the Action bar to change the position of the model.

Reference

PR Advanced Configuration Options (Strategies)

When associating a PR model with a query pipeline, you must select a recommendation strategy to adapt the suggested items based on your use case.

Note that each strategy requires its own set of usage analytics event to provide the expected recommendations:

Recommendation strategy Required events Optional events

Cart recommender (cart)

detail

purchase

None

Frequently bought together (frequentBought)

purchase

refund

add (to cart)

remove (from cart)

Frequently viewed together (frequentViewed)

detail

click

Popular items (Bought) (popularBought)

purchase

refund

Popular items (Viewed) (popularViewed)

detail

click

User recommender (user)

detail

purchase

refund

add (to cart)

remove (from cart)

User Recommender

When leveraging the User recommender strategy, the model suggests products to the current user based on their general interests. To achieve this, the model learns from users' previous actions, and uses this information to find other customers that share similar browsing patterns. The model then suggests products that have been previously browsed by customers who share similar interests with the current user.

Frequently Bought Together

When leveraging the Frequently bought together strategy, the model suggests products frequently bought with the current product based on purchases made by other users. In other words, the model analyzes the items that customers often buy together with the product that the user is currently viewing.

Example

As a user of an electronics retailer commerce website, you are currently viewing a gaming computer. Based on other customers' purchase history, the model suggests gaming mice and keyboards that were bought together with the computer you are currently viewing.

Note

When a Coveo ML PR model leveraging the Frequently bought together strategy doesn’t generate enough recommendations, the model will use the Frequently bought together in different categories, Frequently viewed together, or Popular items (bought) strategies to ensure that recommendations are displayed to the end user.

Frequently Bought Together in Same Category

When leveraging the frequentBoughtSameCategory strategy, the model recommends the most frequently purchased products in the same category as the item the user is currently viewing.

Example

As a user of an electronics retailer commerce website, you are currently viewing a pair of headphones whose category value is headphones.

Since the product page incorporates a recommendations interface that leverages the frequentBoughtSameCategory strategy, the recommended products are the items from the headphones category that have been purchased the most with the item you are currently viewing.

Important

The frequentBoughtSameCategory strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the frequentBoughtSameCategory strategy in your query pipeline, you must associate your model via a JSON configuration.

Note

When a Coveo ML PR model leveraging the Frequently bought together in same category strategy doesn’t generate enough recommendations, the model will use the Frequently bought together, or Popular items (bought) strategies to ensure that recommendations are displayed to the end user.

Frequently Bought Together in Different Categories

When leveraging the frequentBoughtDifferentCategory strategy, the model recommends the products that have been purchased the most with the product that the user is currently viewing. The recommendations are filtered to show products that have a different category than the one the user is currently viewing.

Example

As a user of an electronics retailer commerce website, you are currently viewing a gaming computer whose category value is computer.

Since the product page incorporates a recommendations interface that leverages the frequentBoughtDifferentCategory strategy, the recommended products are the items that have been purchased the most with the computer you are currently viewing, but that doesn’t have computer as the category value.

Important

The frequentBoughtDifferentCategory strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the frequentBoughtDifferentCategory strategy in your query pipeline, you must associate your model via a JSON configuration.

Note

When a Coveo ML PR model leveraging the Frequently bought together in different categories strategy doesn’t generate enough recommendations, the model will use the Frequently bought together, or Popular items (bought) strategies to ensure that recommendations are displayed to the end user.

Frequently Viewed Together

When leveraging the Frequently viewed together strategy, the model suggests items related to each of the current products based on other users` interactions with your commerce implementation in a single visit. Therefore, this strategy analyzes users` navigation behavior to provide the user with a selection of similar products that are often seen together in a single shopping session.

Example

As a user of an electronic retailer commerce website, you are currently viewing the ABC gaming computer. Based on the interactions made by other users that have browsed the same computer in their shopping session, the model suggests products that have frequently been seen together with that computer in the same shopping session.

Since other users have also browsed the 123 and DEF computers along with the ABC gaming computer that you are currently viewing, the model suggests these computers to you.

Note

When a Coveo ML PR model leveraging the Frequently viewed together strategy doesn’t generate enough recommendations, the model will use the Popular items (viewed) strategy to ensure that recommendations are displayed to the end user.

Frequently Viewed Together in the Same Category

When leveraging the frequentViewedSameCategory strategy, the model recommends the most frequently viewed products in the same category as the item the user is currently viewing.

Example

As a user of an electronics retailer commerce website, you are currently viewing a pair of headphones whose category value is headphones.

Since the product page incorporates a recommendations interface that leverages the frequentViewedSameCategory strategy, the recommended products are the items from the headphones category that have been viewed the most with the item you are currently viewing.

Important

The frequentViewedSameCategory strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the frequentViewedSameCategory strategy in your query pipeline, you must associate your model via a JSON configuration.

Note

When a Coveo ML PR model leveraging the Frequently Viewed Together in the Same Category strategy doesn’t generate enough recommendations, the model will use the Frequently viewed together, or Popular items (viewed) strategies to ensure that recommendations are displayed to the end user.

Frequently Viewed Together in Different Categories

When leveraging the frequentViewedDifferentCategory strategy, the model recommends the products that have been viewed the most with the product that the user is currently viewing. The recommendations are filtered to show products that have a different category than the one the user is currently viewing.

Example

As a user of an electronics retailer commerce website, you are currently viewing a gaming computer whose category value is computer.

Since the product page incorporates a recommendations interface that leverages the frequentViewedDifferentCategory strategy, the recommended products are the items that have been viewed the most with the computer you are currently viewing, but that doesn’t have computer as the category value.

Important

The frequentViewedDifferentCategory strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the frequentViewedDifferentCategory strategy in your query pipeline, you must associate your model via a JSON configuration.

Note

When a Coveo ML PR model leveraging the Frequently Viewed Together in different categories strategy doesn’t generate enough recommendations, the model will use the Frequently viewed together, or Popular items (viewed) strategies to ensure that recommendations are displayed to the end user.

Cart Recommender

When leveraging the Cart recommender strategy, the model analyzes frequent buying patterns by grouping sets of products that are frequently purchased together in the same shopping cart.

Based on the products in a given cart, the model recommends other products that were frequently purchased together in previous similar carts. This strategy is ideal for cross-selling items on a shopping cart interface.

Example

As a user of an electronics retailer website, you view your cart which contains a TV stand and a multi-plug outlet extender. Based on other customers' purchase history, the model will suggest other TV accessories, such as HDMI cables, that were bought together with the same TV stand and outlet extender you have in your cart.

When leveraging the Popular items (bought) strategy, the model recommends the most purchased products.

Its usage applies a time discount, so that newer events are always more relevant. This attempts at picking up timely trends.

This strategy is useful when you want to display recommendations on a landing page. It’s also used as a backup solution for other strategies when they didn’t gather enough data to provide relevant recommendations.

When leveraging the Popular items (viewed) strategy, the model recommends the most viewed products.

Its usage applies a time discount, so that newer events are always more relevant. This attempts at picking up timely trends.

This strategy is useful when you want to display recommendations on a landing page and also used as a backup solution for other strategies when they didn’t gather enough data to provide relevant recommendations.

When leveraging the popularBoughtSameCategory strategy, the model recommends the most purchased products in the same category as the item the user is currently viewing.

This strategy is useful as a backup solution for other strategies when they didn’t gather enough data to provide relevant recommendations.

Important

The popularBoughtSameCategory strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the popularBoughtSameCategory strategy in your query pipeline, you must associate your model via a JSON configuration.

When leveraging the popularViewedSameCategory strategy, the model recommends the most viewed products in the same category as the item the user is currently viewing.

This strategy is useful as a backup solution for other strategies when they didn’t gather enough data to provide relevant recommendations.

Important

The popularViewedSameCategory strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the popularViewedSameCategory strategy in your query pipeline, you must associate your model via a JSON configuration.

Recently Viewed

When leveraging the recentlyViewed strategy, the model analyzes the user’s action history to recommend items recently viewed by the user.

Important

The recentlyViewed strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the recentlyViewed strategy in your query pipeline, you must associate your model via a JSON configuration and ensure that the required user profile dimensions are enabled.

Contact us to enable these dimensions.

Recently Bought

When leveraging the recentlyBought strategy, the model analyzes the user’s action history to recommend products that the user has recently purchased.

Important

The recentlyBought strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the recentlyBought strategy in your query pipeline, you must associate your model via a JSON configuration and ensure that the required user profile dimensions are enabled.

Contact us to enable these dimensions.

Buy Again

When leveraging the buyAgain strategy, the model calculates the user’s tendency to repurchase certain products in a given time frame. The model will then recommend that those products be purchased again based on that specific time frame.

Example

As a user of a commerce website, you previously bought dishwasher detergent, dryer sheets, and fabric softener.

Since the website incorporates a recommendations interface that leverages the buyAgain strategy, the model recommends the same products every month because those products are likely to be repurchased monthly.

Important

The buyAgain strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the buyAgain strategy in your query pipeline, you must associate your model via a JSON configuration and ensure that the required user profile dimensions are enabled.

Contact us to enable these dimensions.

Recommendations Based on User Affinity

When leveraging the userAffinity strategy, the model recommends items based on the user’s last actions. These recommendations are filtered to provide products that are part of the user’s preferred category or brand.

Example

As a user of an electronics retailer commerce website, you recently viewed several computers made by the ACME brand.

Since the home page incorporates a recommendations interface that leverages the userAffinity strategy, the recommended items are the products that have been the most viewed by other users along with the computers you recently viewed.

Since the model detected that you have a preference for the computer category and ACME brand, the provided recommendations are filtered to provide other computers, or other products made by the ACME brand.

Important

The userAffinity strategy can’t be selected from the Coveo Administration Console when associating a Coveo ML PR model with a query pipeline.

To use the userAffinity strategy in your query pipeline, you must associate your model via a JSON configuration and ensure that the userBrandStringVector and userCategoryStringVector dimensions are enabled.

Contact us to enable these dimensions.

Model Association Parameters

You can use the following parameters when creating or editing a Coveo ML PR model association.

id (string)

The unique identifier of the model association (automatically generated by the Coveo Search API).

Example: 62579f33-a505-4d07-b77d-545aefb2eea1

position (integer [int32])

The position of the model in the order of execution (see Reorder Model Associations).

Example: 8

modelId (string)

The unique identifier of the model (see Reviewing Coveo Machine Learning Model Information).

Example: c7ab60e2-e6b8-41e8-be6a-ad5c8edc662e

modelDisplayName (string)

The name of the model as selected when creating the model. This field is automatically filled with the name of the Coveo ML model.

Example: MyModelName

modelEngine (string)

The ID of the Coveo ML model (see Creating a Model With JSON). This field is automatically filled with the ID of the Coveo ML model.

Example: ecommerce

modelStatus (string)

The status of the model. This field is automatically generated according to the current ML model status.

Example: ONLINE

condition (string)

The unique identifier of the condition that must be satisfied for a request to be processed by the ML model.

Example: c7ab60e2-e6b8-41e8-be6a-ad5c8edc662e

conditionDefinition (string)

The QPL expression that indicates the condition defined for the model association (see Query Pipeline Language (QPL)). This field is automatically filled when a condition is specified.

Example: when $searchHub is \"internalSearch\"

cacheMaximumAge (string)

The maximum age of cached query results the ML model should accept, in the ISO-8601 format only including the seconds and milliseconds part.

For each incoming query to be processed by the ML model, if a result set for an identical previously made query is available in the cache and this result set isn’t older than the specified value, the ML model makes recommendations based on that cached query result set. Otherwise, the query is executed against the index.

Default: PT105

useAdvancedConfiguration (boolean)

Whether the model association specifies an advanced configuration.

Default: false

rankingModifier (integer [int32])

The ranking score modifier the ML model should apply to each item it recommends.

Default: 0

exclusive (boolean)

Whether the Search API should only return items which were recommended by the ML model, even if other items matching the query were found in the index.

Default: true

customQueryParameters (JValue (object))

A JSON object representing the additional parameters to send to Coveo ML on all queries.

This object allows you to specify the strategy used by the model.

strategy (string)

The strategy used by the model to provide its recommendations.

Available options:

Default: popularViewed

maxRecommendations (integer [int32])

The maximum number of recommendations the ML model should return.

Default: 5

Note

The maxRecommendations parameter value indicates the maximum number of recommendations that the model returns before the Coveo Search API and the index apply subsequent filters (e.g., query pipeline rules or item permission).

For example, a query pipeline containing a recommendation model can be configured to return five recommendations. Since some of the items that the model can recommend are not accessible to the user or have been filtered out by a query pipeline rule, the user sees only three recommended documents.

Setting maxRecommendations to a higher value lets the model query for more items, ensuring that the user obtains the expected number of recommendations.

useAdvancedConfiguration (boolean)

Whether the model association specifies an advanced configuration.

Default: false

Code Sample

The following code sample shows a product recommendations model association in JSON:

{
  "position": 1,
  "modelId": "XXXXXX_ecommerce_XXXXXXXX_XXXX_XXXX_XXXX_XXXXXXXXXXXX",
  "condition": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "exclusive": true,
  "customQueryParameters": {
    "strategy": "popularViewed"
  },
  "useAdvancedConfiguration": false
}

For complete information on PR model available association parameters, see PR Model Association Parameters Reference.

Required Privileges

By default, members of the Administrators and Relevance Managers built-in groups can view and edit elements of the Models (platform-eu | platform-au) page.

The following table indicates the privileges required to use elements of the Models page and associated panels (see Manage Privileges and Privilege Reference).

Action Service - Domain Required access level

View model associations

Machine Learning - Models

Search - Query pipelines

View

Edit model associations

Machine Learning - Models

Search - Query pipelines

Edit

What's next for me?