Getting started (AWS SDK for Python) - Amazon Personalize

Getting started (AWS SDK for Python)

This topic explains how to get started programming Amazon Personalize with the AWS SDK for Python (Boto3).


The following are prerequisite steps for using the Python examples in this guide:

When you finish the getting started exercise, to avoid incurring unnecessary charges, follow the steps in Cleaning up resources to delete the resources you created.

After you complete the prerequisites, run the following Python example to confirm that your environment is configured correctly. If your environment is configured correctly, a list of the available recipes is displayed and you can run the other Python examples in this guide.

import boto3 personalize = boto3.client('personalize') response = personalize.list_recipes() for recipe in response['recipes']: print (recipe)

After you verify that your Python environment is configured correctly, import your data. To use a dataset for training, you need to do the following:

  1. Add a schema. The schema allows Amazon Personalize to parse the training dataset. For a code sample, see Creating a schema using the AWS Python SDK.

  2. Import the data. You create a dataset group which contains one or several datasets that Amazon Personalize can use for training. For a code sample, see Importing bulk records (AWS Python SDK).

  3. (Optional) Add an event tracker. To record interactions events, you must add a tracking ID to associate the event with your dataset group. For a code sample, see Creating an event tracker.

  4. (Optional) Add an event record. To add more data in training and create a better model, you can use events. Events are recorded user activities such as a search, a view, or a purchase. For a code sample, see PutEvents operation.

After you import your data, create a solution and solution version. The solution contains the configurations to train a model. A solution version is a trained model. For more information, see Creating a solution.

When you create a solution version, evaluate its performance before proceeding. For a code sample, see Step 4: Evaluating a solution version.

After you train and evaluate your solution version, you can deploy it using a campaign. A campaign is an endpoint used to host a solution version and make recommendations to users. For a code sample, see Creating a campaign.

After you create a campaign, you can use it to get recommendations. For a code sample, see Getting recommendations.

Getting started using Amazon Personalize APIs with Jupyter (iPython) notebooks

To get started using Amazon Personalize using Jupyter notebooks, clone or download a series of notebooks found in the getting_started folder of the Amazon Personalize samples repository. The notebooks walk you through importing training data, creating a solution, creating a campaign, and getting recommendations using Amazon Personalize.


Before starting with the notebooks, make sure to build your environment following the steps in the