Skip to content

aws.personalize_runtime.get_personalized_ranking

Example SQL Queries

SELECT * FROM
aws.personalize_runtime.get_personalized_ranking
WHERE
"campaign_arn" = 'VALUE'
AND "input_list" = 'VALUE'
AND "user_id" = 'VALUE';

Description

Re-ranks a list of recommended items for the given user. The first item in the list is deemed the most likely item to be of interest to the user.

The solution backing the campaign must have been created using a recipe of type PERSONALIZED_RANKING.

Table Definition

Column NameColumn Data Type
campaign_arn Required Input Column

The Amazon Resource Name (ARN) of the campaign to use for generating the personalized ranking.

VARCHAR
input_list Required Input Column

A list of items (by itemId) to rank. If an item was not included in the training dataset, the item is appended to the end of the reranked list. If you are including metadata in recommendations, the maximum is 50. Otherwise, the maximum is 500.

VARCHAR[]
Show child fields
input_list[]
user_id Required Input Column

The user for which you want the campaign to provide a personalized ranking.

VARCHAR
context Input Column

The contextual metadata to use when getting recommendations. Contextual metadata includes any interaction information that might be relevant when getting a user's recommendations, such as the user's current location or device type.

MAP(VARCHAR, VARCHAR)
filter_arn Input Column

The Amazon Resource Name (ARN) of a filter you created to include items or exclude items from recommendations for a given user. For more information, see Filtering Recommendations.

VARCHAR
filter_values Input Column

The values to use when filtering recommendations. For each placeholder parameter in your filter expression, provide the parameter name (in matching case) as a key and the filter value(s) as the corresponding value. Separate multiple values for one parameter with a comma.

For filter expressions that use an INCLUDE element to include items, you must provide values for all parameters that are defined in the expression. For filters with expressions that use an EXCLUDE element to exclude items, you can omit the filter-values.In this case, Amazon Personalize doesn't use that portion of the expression to filter recommendations.

For more information, see Filtering Recommendations.

MAP(VARCHAR, VARCHAR)
metadata_columns Input Column

If you enabled metadata in recommendations when you created or updated the campaign, specify metadata columns from your Items dataset to include in the personalized ranking. The map key is ITEMS and the value is a list of column names from your Items dataset. The maximum number of columns you can provide is 10.

For information about enabling metadata for a campaign, see Enabling metadata in recommendations for a campaign.

MAP(VARCHAR, VARCHAR[])
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

personalized_ranking

A list of items in order of most likely interest to the user. The maximum is 500.

STRUCT(
"item_id" VARCHAR,
"score" DOUBLE,
"promotion_name" VARCHAR,
"metadata" MAP(VARCHAR, VARCHAR),
"reason" VARCHAR[]
)[]
Show child fields
personalized_ranking[]
Show child fields
personalized_ranking[].item_id

The recommended item ID.

personalized_ranking[].metadata

Metadata about the item from your Items dataset.

personalized_ranking[].promotion_name

The name of the promotion that included the predicted item.

personalized_ranking[].reason[]
personalized_ranking[].score

A numeric representation of the model's certainty that the item will be the next user selection. For more information on scoring logic, see how-scores-work.

recommendation_id

The ID of the recommendation.

VARCHAR