Amazon Personalize
Developer Guide

This is prerelease documentation for a service in preview release. It is subject to change.

Getting Recommendations

Amazon Personalize can get recommendations and personalized rankings from a campaign. For example, if you have a campaign that is trained to give movie recommendations, you can use the following operations to give movie recommendations to users signed into your application or website. For an example, see Getting Started (AWS CLI).

The Amazon Personalize console details page for a campaign includes example code that can use to get recommendations.

Recommendations

Once you have created your campaign, you can use it in your applications to get recommendations. To get recommendations, you call GetRecommendations.

To get a recommendation

  1. Use the following code to get a recommendation. Change the value of campaignArn to the arn of valid campaign. Change the value of userId and itemId to a valid user Id and item Id that is in the data you used to train the solution.

    import boto3 import io if __name__ == "__main__": personalizert = boto3.client('personalize-runtime', region_name='us-west-2') response=personalizert.get_recommendations( campaignArn="campaign arn", userId='83', itemId='396') print(response)
  2. Run the code. A list of recommended items for the user is displayed.

You supply the Amazon Resource Name (ARN) of the required campaign, the user ID and item ID for which you want recommendations. GetRecommendations returns a list of recommended items for the user.

Personalized Rankings

A personalized ranking is a list of recommended items that are re-ranked for a specific user. To get personalized rankings, call PersonalizeRanking. You supply the user ID and a list of recommended items.

To get a personalized ranking

  1. Use the following code to get a personalized ranking. Change the value of campaignArn to the arn of valid campaign. Change the value of userId and inputList to a valid user Id and item list that is in the data you used to train the solution.

    import boto3 import io if __name__ == "__main__": personalizert = boto3.client('personalize-runtime', region_name='us-west-2') response=personalizert.personalize_ranking( campaignArn="campaign arn", userId='83', inputList=['item1','item2']) print(response)
  2. Run the code. a list of ranked recommendations is displayed. The first item in the list is considered by Amazon Personalize to be of most interest to the user.