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

Duplicate the Production Query Pipeline

Once you have created a Coveo ML PR model, the leading practice is to duplicate the query pipeline with which you plan to associate the model, and then associate the model with the pipeline copy.

Once satisfied with the model efficiency on the pipeline copy, dissociate the model from the test pipeline and associate it with the production pipeline. You can test your Coveo ML model’s efficiency by performing A/B tests.

Once you’re done testing the model in the test pipeline, you can delete the test pipeline.

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.

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

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

  1. On the Query Pipelines page, click the query pipeline for which you want to associate a PR model, and then in the Action bar, click Edit Components.

  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.

Edit a PR Model Association

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

  1. On the Query Pipelines page, click the query pipeline for which you want to edit a model association, and then in the Action bar, click Edit Components.

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

  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 page, click the query pipeline for which you want to associate a model, and then in the Action bar, click Edit Components.

  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).

    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 page, click the query pipeline for which you want to edit a model association, and then in the Action bar, click Edit Components.

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

  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.

    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).

    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 page, click the query pipeline from which you want to dissociate a model, and then in the Action bar, click Edit Components.

  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 in the Action Bar, click Dissociate.

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.

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

  1. On the Query Pipelines page, click the query pipeline in which you want to reorder model associations, and then in the Action bar, click Edit Components.

  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.

  4. In the Action bar, use the Move up or Move down arrows 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 (see Event Parameters and Associated Product Recommendation Models).

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 the shopping cart of other users. In other words, the model analyzes the items customers often buy together with the product that the user is currently looking at.

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.

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.

The frequentBoughtSameCategory strategy cannot 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.

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.

The frequentBoughtDifferentCategory strategy cannot 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.

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.

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.

The frequentViewedSameCategory strategy cannot 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.

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.

The frequentViewedDifferentCategory strategy cannot 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.

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.

Given a cart, it will recommend products that were frequently bought 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 commerce website, you are currently viewing your cart where you have a TV and a TV stand. Based on other customers’ purchase history, the model suggests TV accessories, such as HDMI cables, that were bought together with the same TV and TV stand you have in your cart.

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

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 Popular items (viewed) strategy, the model recommends the most viewed products.

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.

The popularBoughtSameCategory strategy cannot 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.

The popularViewedSameCategory strategy cannot 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.

The recentlyViewed strategy cannot 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.

Recently Bought

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

The recentlyBought strategy cannot 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.

Buy Again

When leveraging the buyAgain strategy, the model recommends items already purchased by the user and ranks these items according to the probability the product will be repurchased.

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 items you previously bought because those products are likely to be purchased again.

The buyAgain strategy cannot 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.

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.

The userAffinity strategy cannot 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 required user profile dimensions are enabled.

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

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 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

Recommended Articles