Creating recommenders (AWS CLI) - Amazon Personalize

Creating recommenders (AWS CLI)

After you create a Domain dataset group and import data, you can create recommenders for your domain use cases. A recommender is a Domain dataset group resource that generates recommendations.

For Top picks for your or Recommended for you use cases, Amazon Personalize uses exploration when recommending items. For more information, see Configuring exploration.

Creating a recommender

Use the following AWS CLI code to create a recommender for a domain use case. Run this code for each of your domain use cases. For recipeArn, provide the Amazon Resource Name (ARN) for your use case. The available use cases depend on your domain. For a list of use cases and their ARNs see Choosing a use case.

aws personalize create-recommender \ --name recommender name \ --dataset-group-arn dataset group ARN \ --recipe-arn recipe ARN

Configuring columns used when training

To exclude columns from training, provide the excludedDatasetColumns object in the trainingDataConfig as part of the recommender configuration. For each key in the object, provide the dataset type. For each value, provide the list of columns to exclude. For more information, see Configuring columns used when training.

aws personalize create-recommender \ --name recommender name \ --dataset-group-arn dataset group ARN \ --recipe-arn recipe ARN \ --recommender-config "{\"trainingDataConfig\": {\"excludedDatasetColumns\": { \"datasetType\" : [ \"column1Name\", \"column2Name\"]}}}"

Configuring exploration

For Top picks for your or Recommended for you use cases, Amazon Personalize uses exploration when recommending items. Exploration involves testing different item recommendations to learn how users respond to items with very little interaction data. You can configure exploration with the following:

  • Emphasis on exploring less relevant items (exploration weight) – Configure how much to explore. Specify a decimal value between 0 to 1. The default is 0.3. The closer the value is to 1, the more exploration. With more exploration, recommendations include more items with less item interactions data or relevance based on previous behavior. At zero, no exploration occurs and recommendations are based on current data (relevance).

  • Exploration item age cutoff – Specify the maximum item age in days since the latest interaction across all items in the Item interactions dataset. This defines the scope of item exploration based on item age. Amazon Personalize determines item age based on its creation timestamp or, if creation timestamp data is missing, item interactions data. For more information how Amazon Personalize determines item age, see Creation timestamp data.

    To increase the items Amazon Personalize considers during exploration, enter a greater value. The minimum is 1 day and the default is 30 days. Recommendations might include items that are older than the item age cut off you specify. This is because these items are relevant to the user and exploration didn't identify them.

The following code shows how to configure exploration when you create a recommender for the Top picks for you use case. The example uses the default values.

If you have an Items dataset and want the option to include metadata when you get recommendations, update the recommender-config to add a enableMetadataWithRecommendations field and set it to true.

aws personalize create-recommender \ --name recommender name \ --dataset-group-arn dataset group ARN \ --recipe-arn arn:aws:personalize:::recipe/aws-vod-top-picks \ --recommender-config "{\"itemExplorationConfig\":{\"explorationWeight\":\"0.3\",\"explorationItemAgeCutOff\":\"30\"}}"

Enabling metadata in recommendations

If you have an Items dataset and want the option to include metadata when you get recommendations, set enableMetadataWithRecommendations to true in the recommender-config.

aws personalize create-recommender \ --name recommender name \ --dataset-group-arn dataset group \ --recipe-arn recipe ARN \ --recommender-config "{\"enableMetadataWithRecommendations\": "true"}"