Creating a solution (Amazon CLI)
Important
After you create a solution, you can’t change its configuration. By default, all new solutions use automatic training. With automatic training, you incur training costs while
your solution is active. To avoid unnecessary costs, make sure to delete the solution when you are finished. For information about training
costs, see Amazon Personalize pricing
To create a solution with the Amazon CLI, use the create-solution
command. This command uses the CreateSolution API operation. The following code shows you how to
create a solution that uses automatic training. It automatically creates a new solution version every five days.
To use the code, update it to give the solution a name, specify the Amazon Resource Name (ARN) of your dataset group, optionally change the training frequency, and specify the ARN of the recipe to use. For information about recipes, see Choosing a recipe.
aws personalize create-solution \ --name
solution name
\ --dataset-group-arndataset group ARN
\ --recipe-arnrecipe ARN
\ --perform-auto-training \ --solution-config "{\"autoTrainingConfig\": {\"schedulingExpression\": \"rate(5 days)\"}}"
-
We recommend that you use automatic training. It makes it easier for you to maintain and improve recommendation relevance. By default, all new solutions use automatic training. The default training frequency is every 7 days. Your training frequency depends on your business requirements, the recipe that you use, and how frequently you import data. For more information, see Configuring automatic training.
-
Depending on your recipe, you can modify the code to configure recipe specific properties and hyperparameters (see Hyperparameters and HPO), configure the columns used for training (see Configuring columns used when training (Amazon CLI)), or filter the item interactions data used for training (see Choosing the item interaction data used for training).
-
If you use either the User-Personalization recipe or Personalized-Ranking recipe recipe, you can optimize your solution for an objective, in addition to relevance. For more information, see Optimizing a solution for an additional objective.
After you create the solution, record the solution ARN for future use. With automatic training, solution version creation starts within one after the solution is ACTIVE. If you manually create a solution version within the hour, the solution skips the first automatic training. After training starts, you can get the solution version's Amazon Resource Name (ARN) with the ListSolutionVersions API operation. To get its status, use the DescribeSolutionVersion API opearation.
When the solution version is ACTIVE, you are ready to use it to get recommendations. How you use an active solution version depends on how you get recommendations:
For real-time recommendations, you deploy an ACTIVE solution version with an Amazon Personalize campaign. You use the campaign to get recommendations for your users. See Creating a campaign.
-
For batch recommendations, you specify an ACTIVE solution version when you create a batch inference job or batch segment job. See Batch recommendations and user segments (custom resources).