Optimizing a solution for an additional objective
The primary objective of Amazon Personalize is to predict the most relevant items for your users based on historical and real-time interactions data. These are the items your users will most likely interact with (for example, the items they will most likely click). If you have an additional objective, such as maximizing streaming minutes or increasing revenue, you can create a solution that generates recommendations based on both relevance and your objective.
After you create an Interactions dataset and an Items dataset with a non-null, numerical column metadata attribute, you can create a solution that is optimized for an additional objective based on your item metadata. You can use the Amazon Personalize console, Amazon Command Line Interface (Amazon CLI), or Amazon SDKs.
To optimize a solution for an additional objective, create a new solution with the User-Personalization recipe or Personalized-Ranking recipe and choose the numerical metadata column in your Items dataset that is related to your objective. When generating recommendations, Amazon Personalize gives more importance to items with higher values for this column of data. For example, you might choose a VIDEO_LENGTH column to maximize streaming minutes or a PRICE column to maximize revenue.
Objective requirements are as follows:
-
You can choose only one column for your objective.
-
The column must have a numerical type in your schema.
-
The column can't have a
null
type in your schema.
For more information about schemas and data types, see Schemas.
Topics
Balancing objective emphasis and relevance
There can be a trade-off when recommending items based more on your objective than relevance. For example, if you want to increase revenue through recommendations, recommendations for only expensive items might make items less relevant for your users and decrease user engagement and conversion.
To configure the balance between relevance and your objective, choose one of the following objective sensitivity levels when you create the solution:
-
Off: Amazon Personalize uses primarily interactions data to predict the most relevant items for your user.
-
Low: Amazon Personalize places less emphasis on your objective. Relevance through interactions data is more important.
-
Medium: Amazon Personalize places equal emphasis on your objective and relevance through interactions data.
-
High: Amazon Personalize places more emphasis on your objective. Relevance through interactions data is less important.
Measuring optimization performance
When you create a solution version (train a model) for a solution with an optimization objective, Amazon Personalize generates an average_rewards_at_k
metric.
The score for average_rewards_at_k
tells you how well the solution version performs in achieving your objective. To calculate this metric,
Amazon Personalize calculates the rewards for each user as follows:
rewards_per_user = total rewards from the user's interactions with their top 25 reward generating recommendations / total rewards from the user's interactions with recommendations
The final average_rewards_at_k
is the average of all rewards_per_user
normalized to be a decimal value less than or equal to 1 and greater than 0.
The closer the value is to 1, the more gains on average per user you can expect from recommendations.
For example, if your objective is to maximize revenue from clicks, Amazon Personalize calculates each user score by dividing total revenue generated by the items the user clicked from their top 25 most
expensive recommendations by the revenue from all of the recommended items the user clicked. Amazon Personalize then returns a normalized average of all user scores. The closer the average_rewards_at_k
is to 1, the more revenue on
average you can expect to gain per user from recommendations.
For more information about generating metrics, see Evaluating a solution version with metrics.
Optimizing a solution (console)
To optimize a solution for an additional objective with the Amazon Personalize console, create a new solution and choose the column of numerical item metadata that is related to your objective.
To optimize a solution for an additional objective (console)
-
Open the Amazon Personalize console at https://console.amazonaws.cn/personalize/home
and sign in to your account. -
Choose the dataset group that you want to use for training.
-
In the Create solutions section of the dashboard, choose the Start button. If you have already created a solution, choose the Create solution button.
-
For Solution name, specify a name for the solution.
-
For Recipe, choose either User-Personalization recipe or Personalized-Ranking recipe.
-
In Solution configuration, if your Interactions dataset has EVENT_TYPE or both EVENT_TYPE and EVENT_VALUE columns, optionally use the Event type and Event value threshold fields to choose the interactions data that Amazon Personalize uses when training the model.
For more information see Choosing the interactions data used for training.
-
For Objective, choose the numerical column from the Items dataset that is related to your objective. You can choose only a numerical metadata column.
-
For Objective sensitivity, choose the level of emphasis Amazon Personalize places on the additional objective when generating recommendations. The objective sensitivity configures how Amazon Personalize balances recommending items based on your objective versus relevance through interactions data. For more information, see Balancing objective emphasis and relevance.
-
Configure any hyperparameter options based on your recipe and business needs. Different recipes use different hyperparameters. For available hyperparameters, see the documentation for individual recipes in Choosing a recipe.
-
Choose Next.
-
On the Create solution version page, create a new solution version for the solution. For details, see Creating a solution version (console). Once you create a solution version, you can view the optimization performance in the solution version metrics. See Measuring optimization performance.
Optimizing a solution (Amazon CLI)
You can optimize for an objective only with the User-Personalization or
Personalized-Ranking recipe. To optimize a solution for an additional objective using
the Amazon CLI, create a new solution and specify your objective details using the
optimizationObjective
key in the solutionConfig
object.
The optimizationObjective
has the following fields:
-
itemAttribute
: Specify the name of the numerical metadata column from the Items dataset that relates to your objective. -
objectiveSensitivity
: Specify the level of emphasis that the solution places on your objective when generating recommendations. The objective sensitivity level configures how Amazon Personalize balances recommending items based on your objective versus relevance through interactions data. TheobjectiveSensitivity
can beOFF
, LOW,MEDIUM
orHIGH
. For more information, see Balancing objective emphasis and relevance.
The following is an example of the create-solution
Amazon CLI command. Replace
the solution name
, dataset group arn
, and recipe
arn
values with your own.
For optimizationObjective
, replace COLUMN_NAME
with the
numerical metadata column name from the Items dataset that is related to your objective.
For objectiveSensitivity
, specify OFF, LOW, MEDIUM, or HIGH.
aws personalize create-solution \ --name
solution name
\ --dataset-group-arndataset group arn
\ --recipe-arnrecipe arn
\ --solution-config "{\"optimizationObjective\":{\"itemAttribute\":\"COLUMN_NAME
\",\"objectiveSensitivity\":\"MEDIUM
\"}}"
When your solution is ready, create a new solution version (for an example command see Creating a solution (Amazon CLI)). Once you create a solution version, you can view the optimization performance with the solution version metrics. See Measuring optimization performance.
Optimizing a solution (Amazon SDKs)
You can optimize for an objective only with the User-Personalization or Personalized-Ranking recipe.
To optimize a solution for an additional objective using the Amazon SDKs, create a new
solution and specify your objective details using the optimizationObjective
key in the solutionConfig
object for the solution. The
optimizationObjective
has the following fields:
-
itemAttribute
: Specify the name of the numerical metadata column from the dataset group's Items dataset that relates to your objective. -
objectiveSensitivity
: Specify the level of emphasis that the solution places on your objective when generating recommendations. The objective sensitivity level configures how Amazon Personalize balances recommending items based on your objective versus relevance through interactions data. TheobjectiveSensitivity
can beOFF
,LOW
,MEDIUM
orHIGH
. For more information, see Balancing objective emphasis and relevance.
Use the following code to create a solution with an additional objective with the Amazon SDK for Python (Boto3) or the Amazon SDK for Java 2.x.
When your solution is ready, create a new solution version (for example code see Creating a solution version (Amazon SDKs)). Once you create a solution version, you can view the optimization performance with the solution version metrics. See Measuring optimization performance.
Sample Jupyter notebook
For a sample Jupyter notebook that shows how to create a solution that is optimized for an additional objective based item
metadata, see the objective_optimization