Preparing input data for batch recommendations
A batch inference job imports your batch input JSON data from an Amazon S3 bucket, uses your custom solution version to generate recommendations, and then exports the item recommendations to an Amazon S3 bucket. Before you can get batch recommendations, you must prepare and upload your JSON file to an Amazon S3 bucket. We recommend that you create an output folder in your Amazon S3 bucket or use a separate output Amazon S3 bucket. You can then run multiple batch inference jobs using the same input data location.
If you use a filter with placeholder parameters, such as $GENRE
, you must provide the values for the parameters
in a filterValues
object in your input JSON. For more information, see Providing filter values in your input JSON.
To prepare and import data
-
Format your batch input data depending on your recipe. You can't get batch recommendations with the Trending-Now recipe.
-
For USER_PERSONALIZATION recipes and the Popularity-Count recipe, your input data is a JSON file with a list of userIds
-
For RELATED_ITEMS recipes, your input data is a list of itemIds
-
For PERSONALIZED_RANKING recipes, your input data is a list of userIds, each paired with a collection of itemIds
Separate each row with a new line. For input data examples, see Batch inference job input and output JSON examples.
-
-
Upload your input JSON to an input folder in your Amazon S3 bucket. For more information, see Uploading files and folders by using drag and drop in the Amazon Simple Storage Service User Guide
-
Create a separate location for your output data, either a folder or a different Amazon S3 bucket. By creating a separate location for the output JSON, you can run multiple batch inference jobs with the same input data location.
-
Create a batch inference job. Amazon Personalize outputs the recommendations from your solution version to your output data location.
Batch inference job input and output JSON examples
How you format your input data the recipe you use.
If you use a filter with placeholder parameters, such as $GENRE
, you must provide the values for the parameters
in a filterValues
object in your input JSON. For more information, see Providing filter values in your input JSON.
The following sections list correctly formatted JSON input and output examples for batch inference jobs. You can't get batch recommendations with the Trending-Now recipe.
Topics
USER_PERSONALIZATION recipes
The following shows correctly formatted JSON input and output examples for the USER_PERSONALIZATION recipes. If you use User-Personalization-v2, each recommended item includes a list of reasons for why the item was included in recommendations. This list can be empty. For information about possible reasons, see Recommendation reasons with User-Personalization-v2.
POPULAR_ITEMS recipes (Popularity-Count only)
The following shows correctly formatted JSON input and output examples for the Popularity-Count recipe. You can't get batch recommendations with the Trending-Now recipe.
PERSONALIZED_RANKING recipes
The following shows correctly formatted JSON input and output examples for PERSONALIZED_RANKING recipes.
RELATED_ITEMS recipes
The following shows correctly formatted JSON input and output examples for RELATED_ITEMS recipes.
The following shows correctly formatted JSON input and output examples for the Similar-Items recipe with themes.