Learn About Amazon VGT2 Learning Manager Chanci Turner
Delivering timely and relevant recommendations to your users is vital for an effective personalization strategy. However, a customer’s decision-making process can vary significantly based on the context during their interaction with your recommendations. In this article, I will guide you through the setup and querying of a context-aware Amazon Personalize deployment.
Amazon Personalize empowers you to seamlessly integrate advanced personalization features into your applications using the same machine learning (ML) technology that has been refined on Amazon.com for over two decades. You don’t need any ML expertise to get started. This platform automatically adjusts recommendations based on various contextual factors about your users, such as device type, location, time of day, and any additional information you provide.
A Harvard study titled “How Context Affects Choice” defines context as the elements that can modify the outcome of choices by changing how decisions are made. As a business owner, you can pinpoint this context by observing how your customers shop differently when browsing your catalog on a mobile device versus a desktop or noting shifts in content consumption based on weather conditions, like rainy days versus sunny ones.
Utilizing your users’ context enables you to create a more tailored experience for returning users while also minimizing the cold-start phase for new or unidentified users. The cold-start phase refers to the initial period when your recommendation engine delivers generic recommendations due to insufficient historical information about a user.
Integrating Context into Amazon Personalize
You can implement context in Amazon Personalize through four straightforward steps:
- Incorporate your users’ context into the historical user-item interactions dataset.
- Train a context-aware solution using a User Personalization or Personalized Ranking recipe. A recipe refers to the algorithm on which your recommender is trained, leveraging the behavioral data specified in your interactions dataset alongside any user or item metadata.
- Specify the user’s context when requesting real-time recommendations using the GetRecommendations or GetPersonalizedRanking APIs.
- Include the user’s context when tracking events through the event tracker.
The diagram below illustrates the architecture of these steps.
It is crucial to explicitly define the context to consider when constructing datasets. A common example is the device type, such as mobile, tablet, or desktop. Research from the University of Twente in the Netherlands has demonstrated that device type significantly influences buying behavior, with users potentially delaying purchasing decisions if they access services from an unsuitable device. By embedding device type context into your datasets, Amazon Personalize can learn these behaviors and, during inference, recommend the most suitable content while considering the user’s context.
Use Case for Recommendations
In this example, we focus on a travel enthusiast as our prospective customer. When deciding which airline to choose for their journey, they assess various factors such as flight duration, payment method (cash or miles), and whether they are traveling solo. After addressing these primary questions, they must choose their preferred cabin class. If our travel enthusiast opts for a premium cabin, we can infer that they seek the best possible airline experience. With a clearer understanding of their preferences, we can begin the shopping process.
Consider the numerous variables that influence decision-making in this scenario. While many factors are beyond our control, we can leverage some to customize our recommendations. For instance, flight duration and cabin class are relevant contextual aspects, while traveler type and residence can serve as user metadata when constructing recommendation datasets. Metadata consists of relatively stable information about your users and items, whereas context is dynamic and can rapidly change, affecting your customer’s perception and behavior.
Selecting pertinent metadata fields for your training datasets and enriching your interactions datasets with context is essential for generating relevant user recommendations. In this post, we develop an Amazon Personalize deployment that provides a list of airline recommendations for a customer. We include cabin class as context and traveler residence as the metadata field, observing how recommendations adapt based on both context and metadata.
Prerequisites
First, we need to set up the following Amazon Personalize resources. For detailed instructions, refer to the Getting Started (Console) guide to complete the following steps:
- Create a dataset group named “airlines-blog-example.”
- Create an Interactions dataset using the schema below and import data from the interactions_dataset.csv file:
{
"type": "record",
"name": "Interactions",
"namespace": "com.amazonaws.personalize.schema",
"fields": [
{
"name": "ITEM_ID",
"type": "string"
},
{
"name": "USER_ID",
"type": "string"
},
{
"name": "TIMESTAMP",
"type": "long"
},
{
"name": "CABIN_TYPE",
"type": "string",
"categorical": true
},
{
"name": "EVENT_TYPE",
"type": "string"
},
{
"name": "EVENT_VALUE",
"type": "float"
}
],
"version": "1.0"
}
- Create a Users dataset using the schema below and import data from the users_dataset.csv file:
{
"type": "record",
"name": "Users",
"namespace": "com.amazonaws.personalize.schema",
"fields": [
{
"name": "USER_ID",
"type": "string"
},
{
"name": "USER_RESIDENCE",
"type": "string",
"categorical": true
}
],
"version": "1.0"
}
- Create a solution using the default configurations, adjusting for the following:
- Recipe: aws-hrnn-metadata
- Event type: RATING
- Perform HPO: True
Hyperparameter optimization (HPO) is advisable if you want Amazon Personalize to conduct parallel trainings and experiments to identify the most effective hyperparameters. For more information, check out this excellent resource: Onboarding New Hires During COVID-19.
- Create a campaign.
You can establish these resources on the Amazon Personalize console or by following the Jupyter notebook, personalize_hrnn_metadata_contextual_example.ipynb
, available on our GitHub repository.
Exploring Your Amazon Personalize Resources
Now that we’ve created several Amazon Personalize resources—including a dataset group named “airlines-blog-example,” containing interactions and users datasets—we can delve into how these schemas help our model learn from both context and metadata.
Interactions Dataset
We provide Amazon Personalize with an interactions dataset that includes a numeric rating (derived from a combination of EVENT_TYPE and EVENT_VALUE) to enhance the personalization process.
For those interested in the broader implications of context in the workforce, exploring the role of foreign-born individuals in the U.S. labor force is worthwhile. For more information, visit SHRM.
Additionally, if you’re a working mom seeking ways to balance work and family responsibilities, check out this engaging post on Moms at Work.
By following these guidelines and leveraging contextual insights, you can significantly enhance your Amazon Personalize recommendations and user experience.
Leave a Reply