Increasing recommendation relevance with contextual metadata - Amazon Personalize
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Increasing recommendation relevance with contextual metadata

To increase recommendation relevance, include contextual metadata for a user, such as their device type or the time of day, when you get item recommendations or get a personalized ranking.

To use contextual metadata, the schema of the Item interactions dataset must have a metadata fields for the contextual data. For example, a DEVICE field (see Schemas).

For Domain dataset groups, the following recommender use cases can use contextual metadata:

For custom resources, recipes that use contextual metadata include the following:

For more information on contextual information, see the following Amazon Machine Learning Blog post: Increasing the relevance of your Amazon Personalize recommendations by leveraging contextual information.

You can get recommendations with contextual metadata with the Amazon Personalize console, Amazon Command Line Interface (Amazon CLI), or Amazon SDKs.

Getting recommendations using contextual metadata (Amazon Python SDK)

To increase recommendation relevance, include contextual metadata for a user, such as their device type or the time of day, when you get item recommendations or get a personalized ranking.

Use the following code to get a recommendation based on contextual metadata. For context, for each key-value pair, provide the metadata field as the key and the context data as the value. In the following sample code, the key is DEVICE and the value is mobile phone. Replace these values and the Campaign ARN and User ID with your own. If you created a recommender, replace campaignArn with recommenderArn. A list of recommended items for the user displays.

import boto3 personalizeRt = boto3.client('personalize-runtime') response = personalizeRt.get_recommendations( campaignArn = 'Campaign ARN', userId = 'User ID', context = { 'DEVICE': 'mobile phone' } ) print("Recommended items") for item in response['itemList']: print (item['itemId'])