All Products
Search
Document Center

OpenSearch:Intervention dictionaries for category prediction

Last Updated:Mar 06, 2023

Overview

OpenSearch allows you to intervene in the calculation results of category prediction models that have been trained by performing the following steps, which are similar to those for query analysis intervention:

1. Create an intervention dictionary for category prediction. To create an intervention dictionary, log on to the OpenSearch console. In the left-side navigation pane, choose Search Algorithm Center > Retrieval Configuration. On the Basic Configuration page, click Dictionary Management in the left-side pane. On the Dictionary Management page, click Create in the upper-left corner. Specify a name for the intervention dictionary, select a dictionary type, and then click Save. After the intervention dictionary is created, it appears in the dictionary list.

2. Create and manage intervention entries in the intervention dictionary. To go to the entry management page of the created dictionary, find the dictionary in the dictionary list and click Manage Entries in the Actions column. On this page, create and manage intervention entries as needed. To change the order of the retrieved documents that are related to a category or retrieve documents that are related to a category, you can set, delete, or change the value of relevance to the category as needed.

3. Use the intervention dictionary. After you create intervention entries in the intervention dictionary, you can use the intervention dictionary in category prediction models. If an intervention dictionary and a category prediction model set different values of relevance to the same category for a search query, the relevance value in the intervention dictionary prevails.

  • OpenSearch uses 0 to represent none relevance, 1 to represent weak relevance, and 2 to represent strong relevance. For example, for the search query "A Smile is Beautiful", the value of relevance to category 20 is 0 and the value of relevance to category 10 is 2 in a category prediction model. However, in an intervention dictionary, the value of relevance to category 20 is 2 and the value of relevance to category 30 is 1. In this case, the following relevance values take effect for the search query "A Smile is Beautiful": The value of relevance to category 20 is 2, the value of relevance to category 30 is 1, and the value of relevance to category 10 is 2.

Example

Scenario: An E-commerce has configured category prediction models for an application instance in OpenSearch. However, the returned search results in the online environment are unsatisfactory. To resolve this issue, intervention in category prediction is implemented.

Unsatisfactory search results: When the search query is "milk", commodities about milk cups instead of milk are among the top in search results.

Problem description: OpenSearch can calculate the sort scores of search results for a query search by using category prediction models. In this example, the sort scores of the search results for the search query "milk" are incorrect.

Solution: Create an intervention dictionary for category prediction and configure the search query "milk" in an intervention entry. In this example, the ID of the household supplies category to which milk cups belong is 20 and the ID of the food category to which milk belongs is 15. To intervene in the search results of the search query "milk", you can set the value of relevance to category 20 to 1 and the value of relevance to category 15 to 2 for the search query "milk".

Procedure:

1. Log on to the OpenSearch console. In the left-side navigation pane, choose Search Algorithm Center > Retrieval Configuration. On the Basic Configuration page, click Dictionary Management in the left-side pane. On the Dictionary Management page, click Create in the upper-left corner to create an intervention dictionary. In the Create Query Analysis Dictionary panel, specify a name for the intervention dictionary and set the Dictionary Type parameter to Category Prediction Intervention.

imageimage

2. On the Manage Entries page of the created intervention dictionary, click Add Intervention Entry. In the Add Intervention Entries panel, enter milk in the Query column and 20-1;15-2 in the Category ID-Relevance column. The relevance values are 2, 1, 0 in descending order by the relevance.image

image

3. Apply the intervention dictionary to a category prediction model that is used in an online application.

image

Usage notes

  • You cannot change the name of an intervention dictionary after it is created.

  • You must specify different search queries for different intervention entries. You can add, delete, or change the value of relevance to a category for a search query that already exists in an intervention dictionary for category prediction.

  • You can set the value of relevance to a category in pairs in the following format: category ID-relevance value. If you want to set the value of relevance to multiple categories for a search query, you must separate the pairs with a semicolon (;).

  • If an intervention entry remains in the Validating state, you can click Refresh to obtain the latest status.

  • An intervention dictionary can be used by multiple category prediction models.

  • Intervention dictionaries do not affect the training of category prediction models.

  • If an intervention dictionary is used by a model, no matter whether the model is applied to an online application, you cannot delete the dictionary. You must first remove the dictionary from the model.

Limits

  • You can create a maximum of 10 intervention dictionaries for category prediction.

  • You can specify only one search query for an intervention entry. Each search query supports five values of relevance to categories.

  • You can create a maximum of 500 intervention entries in an intervention dictionary for category prediction.

  • An intervention entry takes effect only when the actual search query fully matches the predefined search query in the entry. For example, you set the value of relevance to category 23 to 2 for the search query "dress". When the actual search query is "dress", OpenSearch calculates the sort score for search results about category 23 based on the relevance value. However, the calculation is not performed is the actual search query is "2018 dress".

  • OpenSearch normalizes the content of intervention entries. All uppercase letters are converted into lowercase letters and all full-width characters are converted into half-width characters.