In this video, you’ll see how to use AWS Data Exchange to improve
Amazon Personalize recommendations.
With this solution, you can leverage third-party data sets from AWS Data
Exchange to train an Amazon Personalize machine learning model that builds
contextualized recommendations for use in consumer-facing applications.
To get started, let’s take a quick look at the AWS services we’ll be using.
Amazon Personalize is a fully managed machine learning service that uses your
data to generate item recommendations for your users.
We’ve used an existing AWS Data Exchange subscription to obtain a
third-party dataset that forecasts long-range weather trends.
We created an Amazon Simple Storage Service (Amazon S3)
bucket to store our weather dataset.
Here are the dataset files.
We’ll use this Amazon SageMaker notebook to build our machine learning code.
When we created the notebook, Identity and Access Management (IAM) full-access
permissions were added for Amazon S3, Amazon Personalize, and Amazon SageMaker.
We also created an IAM role that gives Amazon Personalize read-only access to our S3 bucket.
Let’s explore our Amazon SageMaker Notebook code.
The code begins with our import dependencies and some helper functions.
Next, we configured the bucket and data output location.
Now we’ll download the weather dataset that’s in our S3 bucket.
Let’s query the downloaded weather data to see what it looks like.
We’ll filter for weather data from Santiago, Chile.
We now have average, maximum, and minimum temperatures for
Santiago during a one-month timeframe.
In our code, we have a helper function that takes an input timestamp
and returns a temperature category.
Our categories are very cold, cold, slightly cold, lukewarm, hot, and very hot.
Let’s test our helper function by passing in a date timestamp.
In this case, lukewarm is returned.
Next, we’ll prepare our Amazon Personalize data.
We’ll be using these datasets in combination with the weather dataset we saw earlier.
Let’s look at each dataset.
Our items dataset stores beverage products like beer, juice, and water.
Our user dataset contains only two fields: user Id and persona.
Persona represents the categories of beverages that a user likes
and will be used to train the recommendations model.
Next, we’ll combine the items and user datasets with our AWS Data Exchange
weather dataset to create a dataset of 2.5 million interactions.
This will mimic the behavior of an e-commerce website.
Let’s explore the interactions dataset we just created.
We can see when items were viewed by individual users.
The timestamps correlate to our daily temperature categories, such as lukewarm.
Let's explore further how our interactions dataset is composed.
The majority of interactions are product views.
Other interaction types are product added, cart viewed, checkout started, and order completed.
We also have the distribution of temperature categories present in the dataset.
Most days are lukewarm or hot.
Let’s upload our interactions, items, and users files into S3.
Now we can begin configuring Amazon Personalize to train a model
for generating recommendations.
First, we’ll create schemas in Personalize
that map to the columns in the CSVs we staged in our S3 bucket.
Next, we’ll create a dataset group that will contain our three datasets
in Amazon Personalize.
Next we’ll create datasets in Amazon Personalize for our three dataset types.
Now we’ll import our datasets into Personalize through the use of import jobs.
The import jobs use the IAM role that we saw at the start of the video.
We’ll create three import jobs to import each file into its respective dataset.
With the import jobs now completed, we’ll now create the product recommendations
solution that will train our model.
The product recommendation solution consists of the dataset group and a recipe for training.
In this case, we’ll use a recipe called aws-user-personalization.
You can learn more about available recipes in the reference material for this video.
Now, let's create a campaign that will help us to get the recommendations
from our solution version.
With our campaign created and a model trained, we can test the model with different users.
For our first example, let's look at user_id 100, who likes juice, water, and sparkling beverages.
Let’s see what the campaign recommends for this user.
The top five beverages for this user are juices and waters.
These categories align with this user’s persona preferences.
Let’s see what happens when we change the temperature context to a slightly cold day.
The ranking of beverage preferences has changed.
If we shift our temperature to hot, the recommendations change again.
Let’s select an unknown or anonymous user.
We’ll get recommendations for a lukewarm day.
In this case, all the recommendations are flavored waters.
Let’s change the weather context to a hot day.
Soda now tops the list, above the flavored water.
Contextual information can also be leveraged for users that are new to the
system to enhance recommendations for cold start scenarios.
You’ve just seen how to use AWS Data Exchange to improve Amazon
Personalize recommendations.
You can learn more about this topic in the description and links for this video.
Thanks for watching. Now it's your turn to try.