Amazon Personalize

2020/06/05 - Amazon Personalize - 4 new 2 updated api methods

Changes  [Personalize] Adds ability to create and apply filters.

DescribeFilter (new) Link ¶

Describes a filter's properties.

See also: AWS API Documentation

Request Syntax

client.describe_filter(
    filterArn='string'
)
type filterArn

string

param filterArn

[REQUIRED]

The ARN of the filter to describe.

rtype

dict

returns

Response Syntax

{
    'filter': {
        'name': 'string',
        'filterArn': 'string',
        'creationDateTime': datetime(2015, 1, 1),
        'lastUpdatedDateTime': datetime(2015, 1, 1),
        'datasetGroupArn': 'string',
        'failureReason': 'string',
        'filterExpression': 'string',
        'status': 'string'
    }
}

Response Structure

  • (dict) --

    • filter (dict) --

      The filter's details.

      • name (string) --

        The name of the filter.

      • filterArn (string) --

        The ARN of the filter.

      • creationDateTime (datetime) --

        The time at which the filter was created.

      • lastUpdatedDateTime (datetime) --

        The time at which the filter was last updated.

      • datasetGroupArn (string) --

        The ARN of the dataset group to which the filter belongs.

      • failureReason (string) --

        If the filter failed, the reason for its failure.

      • filterExpression (string) --

        Specifies the type of item interactions to filter out of recommendation results. The filter expression must follow the following format:

        EXCLUDE itemId WHERE INTERACTIONS.event_type in ("EVENT_TYPE")

        Where "EVENT_TYPE" is the type of event to filter out. For more information, see Using Filters with Amazon Personalize.

      • status (string) --

        The status of the filter.

DeleteFilter (new) Link ¶

Deletes a filter.

See also: AWS API Documentation

Request Syntax

client.delete_filter(
    filterArn='string'
)
type filterArn

string

param filterArn

[REQUIRED]

The ARN of the filter to delete.

returns

None

ListFilters (new) Link ¶

Lists all filters that belong to a given dataset group.

See also: AWS API Documentation

Request Syntax

client.list_filters(
    datasetGroupArn='string',
    nextToken='string',
    maxResults=123
)
type datasetGroupArn

string

param datasetGroupArn

The ARN of the dataset group that contains the filters.

type nextToken

string

param nextToken

A token returned from the previous call to ListFilters for getting the next set of filters (if they exist).

type maxResults

integer

param maxResults

The maximum number of filters to return.

rtype

dict

returns

Response Syntax

{
    'Filters': [
        {
            'name': 'string',
            'filterArn': 'string',
            'creationDateTime': datetime(2015, 1, 1),
            'lastUpdatedDateTime': datetime(2015, 1, 1),
            'datasetGroupArn': 'string',
            'failureReason': 'string',
            'status': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • Filters (list) --

      A list of returned filters.

      • (dict) --

        A short summary of a filter's attributes.

        • name (string) --

          The name of the filter.

        • filterArn (string) --

          The ARN of the filter.

        • creationDateTime (datetime) --

          The time at which the filter was created.

        • lastUpdatedDateTime (datetime) --

          The time at which the filter was last updated.

        • datasetGroupArn (string) --

          The ARN of the dataset group to which the filter belongs.

        • failureReason (string) --

          If the filter failed, the reason for the failure.

        • status (string) --

          The status of the filter.

    • nextToken (string) --

      A token for getting the next set of filters (if they exist).

CreateFilter (new) Link ¶

Creates a recommendation filter. For more information, see Using Filters with Amazon Personalize.

See also: AWS API Documentation

Request Syntax

client.create_filter(
    name='string',
    datasetGroupArn='string',
    filterExpression='string'
)
type name

string

param name

[REQUIRED]

The name of the filter to create.

type datasetGroupArn

string

param datasetGroupArn

[REQUIRED]

The ARN of the dataset group that the filter will belong to.

type filterExpression

string

param filterExpression

[REQUIRED]

The filter expression that designates the interaction types that the filter will filter out. A filter expression must follow the following format:

EXCLUDE itemId WHERE INTERACTIONS.event_type in ("EVENT_TYPE")

Where "EVENT_TYPE" is the type of event to filter out. To filter out all items with any interactions history, set "*" as the EVENT_TYPE. For more information, see Using Filters with Amazon Personalize.

rtype

dict

returns

Response Syntax

{
    'filterArn': 'string'
}

Response Structure

  • (dict) --

    • filterArn (string) --

      The ARN of the new filter.

CreateBatchInferenceJob (updated) Link ¶
Changes (request)
{'filterArn': 'string'}

Creates a batch inference job. The operation can handle up to 50 million records and the input file must be in JSON format. For more information, see recommendations-batch .

See also: AWS API Documentation

Request Syntax

client.create_batch_inference_job(
    jobName='string',
    solutionVersionArn='string',
    filterArn='string',
    numResults=123,
    jobInput={
        's3DataSource': {
            'path': 'string',
            'kmsKeyArn': 'string'
        }
    },
    jobOutput={
        's3DataDestination': {
            'path': 'string',
            'kmsKeyArn': 'string'
        }
    },
    roleArn='string'
)
type jobName

string

param jobName

[REQUIRED]

The name of the batch inference job to create.

type solutionVersionArn

string

param solutionVersionArn

[REQUIRED]

The Amazon Resource Name (ARN) of the solution version that will be used to generate the batch inference recommendations.

type filterArn

string

param filterArn

The ARN of the filter to apply to the batch inference job. For more information on using filters, see Using Filters with Amazon Personalize.

type numResults

integer

param numResults

The number of recommendations to retreive.

type jobInput

dict

param jobInput

[REQUIRED]

The Amazon S3 path that leads to the input file to base your recommendations on. The input material must be in JSON format.

  • s3DataSource (dict) -- [REQUIRED]

    The URI of the Amazon S3 location that contains your input data. The Amazon S3 bucket must be in the same region as the API endpoint you are calling.

    • path (string) -- [REQUIRED]

      The file path of the Amazon S3 bucket.

    • kmsKeyArn (string) --

      The Amazon Resource Name (ARN) of the Amazon Key Management Service (KMS) key that Amazon Personalize uses to encrypt or decrypt the input and output files of a batch inference job.

type jobOutput

dict

param jobOutput

[REQUIRED]

The path to the Amazon S3 bucket where the job's output will be stored.

  • s3DataDestination (dict) -- [REQUIRED]

    Information on the Amazon S3 bucket in which the batch inference job's output is stored.

    • path (string) -- [REQUIRED]

      The file path of the Amazon S3 bucket.

    • kmsKeyArn (string) --

      The Amazon Resource Name (ARN) of the Amazon Key Management Service (KMS) key that Amazon Personalize uses to encrypt or decrypt the input and output files of a batch inference job.

type roleArn

string

param roleArn

[REQUIRED]

The ARN of the Amazon Identity and Access Management role that has permissions to read and write to your input and out Amazon S3 buckets respectively.

rtype

dict

returns

Response Syntax

{
    'batchInferenceJobArn': 'string'
}

Response Structure

  • (dict) --

    • batchInferenceJobArn (string) --

      The ARN of the batch inference job.

DescribeBatchInferenceJob (updated) Link ¶
Changes (response)
{'batchInferenceJob': {'filterArn': 'string'}}

Gets the properties of a batch inference job including name, Amazon Resource Name (ARN), status, input and output configurations, and the ARN of the solution version used to generate the recommendations.

See also: AWS API Documentation

Request Syntax

client.describe_batch_inference_job(
    batchInferenceJobArn='string'
)
type batchInferenceJobArn

string

param batchInferenceJobArn

[REQUIRED]

The ARN of the batch inference job to describe.

rtype

dict

returns

Response Syntax

{
    'batchInferenceJob': {
        'jobName': 'string',
        'batchInferenceJobArn': 'string',
        'filterArn': 'string',
        'failureReason': 'string',
        'solutionVersionArn': 'string',
        'numResults': 123,
        'jobInput': {
            's3DataSource': {
                'path': 'string',
                'kmsKeyArn': 'string'
            }
        },
        'jobOutput': {
            's3DataDestination': {
                'path': 'string',
                'kmsKeyArn': 'string'
            }
        },
        'roleArn': 'string',
        'status': 'string',
        'creationDateTime': datetime(2015, 1, 1),
        'lastUpdatedDateTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • batchInferenceJob (dict) --

      Information on the specified batch inference job.

      • jobName (string) --

        The name of the batch inference job.

      • batchInferenceJobArn (string) --

        The Amazon Resource Name (ARN) of the batch inference job.

      • filterArn (string) --

        The ARN of the filter used on the batch inference job.

      • failureReason (string) --

        If the batch inference job failed, the reason for the failure.

      • solutionVersionArn (string) --

        The Amazon Resource Name (ARN) of the solution version from which the batch inference job was created.

      • numResults (integer) --

        The number of recommendations generated by the batch inference job. This number includes the error messages generated for failed input records.

      • jobInput (dict) --

        The Amazon S3 path that leads to the input data used to generate the batch inference job.

        • s3DataSource (dict) --

          The URI of the Amazon S3 location that contains your input data. The Amazon S3 bucket must be in the same region as the API endpoint you are calling.

          • path (string) --

            The file path of the Amazon S3 bucket.

          • kmsKeyArn (string) --

            The Amazon Resource Name (ARN) of the Amazon Key Management Service (KMS) key that Amazon Personalize uses to encrypt or decrypt the input and output files of a batch inference job.

      • jobOutput (dict) --

        The Amazon S3 bucket that contains the output data generated by the batch inference job.

        • s3DataDestination (dict) --

          Information on the Amazon S3 bucket in which the batch inference job's output is stored.

          • path (string) --

            The file path of the Amazon S3 bucket.

          • kmsKeyArn (string) --

            The Amazon Resource Name (ARN) of the Amazon Key Management Service (KMS) key that Amazon Personalize uses to encrypt or decrypt the input and output files of a batch inference job.

      • roleArn (string) --

        The ARN of the Amazon Identity and Access Management (IAM) role that requested the batch inference job.

      • status (string) --

        The status of the batch inference job. The status is one of the following values:

        • PENDING

        • IN PROGRESS

        • ACTIVE

        • CREATE FAILED

      • creationDateTime (datetime) --

        The time at which the batch inference job was created.

      • lastUpdatedDateTime (datetime) --

        The time at which the batch inference job was last updated.