Amazon Personalize

2020/08/06 - Amazon Personalize - 5 updated api methods

Changes  Add 'exploration' functionality

CreateBatchInferenceJob (updated) Link ¶
Changes (request)
{'batchInferenceJobConfig': {'itemExplorationConfig': {'string': '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',
    batchInferenceJobConfig={
        'itemExplorationConfig': {
            'string': '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.

type batchInferenceJobConfig

dict

param batchInferenceJobConfig

The configuration details of a batch inference job.

  • itemExplorationConfig (dict) --

    A string to string map specifying the inference hyperparameters you wish to use for hyperparameter optimization. See customizing-solution-config-hpo.

    • (string) --

      • (string) --

rtype

dict

returns

Response Syntax

{
    'batchInferenceJobArn': 'string'
}

Response Structure

  • (dict) --

    • batchInferenceJobArn (string) --

      The ARN of the batch inference job.

CreateCampaign (updated) Link ¶
Changes (request)
{'campaignConfig': {'itemExplorationConfig': {'string': 'string'}}}

Creates a campaign by deploying a solution version. When a client calls the GetRecommendations and GetPersonalizedRanking APIs, a campaign is specified in the request.

Minimum Provisioned TPS and Auto-Scaling

A transaction is a single GetRecommendations or GetPersonalizedRanking call. Transactions per second (TPS) is the throughput and unit of billing for Amazon Personalize. The minimum provisioned TPS ( minProvisionedTPS ) specifies the baseline throughput provisioned by Amazon Personalize, and thus, the minimum billing charge. If your TPS increases beyond minProvisionedTPS , Amazon Personalize auto-scales the provisioned capacity up and down, but never below minProvisionedTPS , to maintain a 70% utilization. There's a short time delay while the capacity is increased that might cause loss of transactions. It's recommended to start with a low minProvisionedTPS , track your usage using Amazon CloudWatch metrics, and then increase the minProvisionedTPS as necessary.

Status

A campaign can be in one of the following states:

  • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED

  • DELETE PENDING > DELETE IN_PROGRESS

To get the campaign status, call DescribeCampaign.

Note

Wait until the status of the campaign is ACTIVE before asking the campaign for recommendations.

Related APIs

  • ListCampaigns

  • DescribeCampaign

  • UpdateCampaign

  • DeleteCampaign

See also: AWS API Documentation

Request Syntax

client.create_campaign(
    name='string',
    solutionVersionArn='string',
    minProvisionedTPS=123,
    campaignConfig={
        'itemExplorationConfig': {
            'string': 'string'
        }
    }
)
type name

string

param name

[REQUIRED]

A name for the new campaign. The campaign name must be unique within your account.

type solutionVersionArn

string

param solutionVersionArn

[REQUIRED]

The Amazon Resource Name (ARN) of the solution version to deploy.

type minProvisionedTPS

integer

param minProvisionedTPS

[REQUIRED]

Specifies the requested minimum provisioned transactions (recommendations) per second that Amazon Personalize will support.

type campaignConfig

dict

param campaignConfig

The configuration details of a campaign.

  • itemExplorationConfig (dict) --

    A string to string map specifying the inference hyperparameters you wish to use for hyperparameter optimization. See customizing-solution-config-hpo.

    • (string) --

      • (string) --

rtype

dict

returns

Response Syntax

{
    'campaignArn': 'string'
}

Response Structure

  • (dict) --

    • campaignArn (string) --

      The Amazon Resource Name (ARN) of the campaign.

DescribeBatchInferenceJob (updated) Link ¶
Changes (response)
{'batchInferenceJob': {'batchInferenceJobConfig': {'itemExplorationConfig': {'string': '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'
            }
        },
        'batchInferenceJobConfig': {
            'itemExplorationConfig': {
                'string': '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.

      • batchInferenceJobConfig (dict) --

        A string to string map of the configuration details of a batch inference job.

        • itemExplorationConfig (dict) --

          A string to string map specifying the inference hyperparameters you wish to use for hyperparameter optimization. See customizing-solution-config-hpo.

          • (string) --

            • (string) --

      • 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.

DescribeCampaign (updated) Link ¶
Changes (response)
{'campaign': {'campaignConfig': {'itemExplorationConfig': {'string': 'string'}},
              'latestCampaignUpdate': {'campaignConfig': {'itemExplorationConfig': {'string': 'string'}}}}}

Describes the given campaign, including its status.

A campaign can be in one of the following states:

  • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED

  • DELETE PENDING > DELETE IN_PROGRESS

When the status is CREATE FAILED , the response includes the failureReason key, which describes why.

For more information on campaigns, see CreateCampaign.

See also: AWS API Documentation

Request Syntax

client.describe_campaign(
    campaignArn='string'
)
type campaignArn

string

param campaignArn

[REQUIRED]

The Amazon Resource Name (ARN) of the campaign.

rtype

dict

returns

Response Syntax

{
    'campaign': {
        'name': 'string',
        'campaignArn': 'string',
        'solutionVersionArn': 'string',
        'minProvisionedTPS': 123,
        'campaignConfig': {
            'itemExplorationConfig': {
                'string': 'string'
            }
        },
        'status': 'string',
        'failureReason': 'string',
        'creationDateTime': datetime(2015, 1, 1),
        'lastUpdatedDateTime': datetime(2015, 1, 1),
        'latestCampaignUpdate': {
            'solutionVersionArn': 'string',
            'minProvisionedTPS': 123,
            'campaignConfig': {
                'itemExplorationConfig': {
                    'string': 'string'
                }
            },
            'status': 'string',
            'failureReason': 'string',
            'creationDateTime': datetime(2015, 1, 1),
            'lastUpdatedDateTime': datetime(2015, 1, 1)
        }
    }
}

Response Structure

  • (dict) --

    • campaign (dict) --

      The properties of the campaign.

      • name (string) --

        The name of the campaign.

      • campaignArn (string) --

        The Amazon Resource Name (ARN) of the campaign.

      • solutionVersionArn (string) --

        The Amazon Resource Name (ARN) of a specific version of the solution.

      • minProvisionedTPS (integer) --

        Specifies the requested minimum provisioned transactions (recommendations) per second.

      • campaignConfig (dict) --

        The configuration details of a campaign.

        • itemExplorationConfig (dict) --

          A string to string map specifying the inference hyperparameters you wish to use for hyperparameter optimization. See customizing-solution-config-hpo.

          • (string) --

            • (string) --

      • status (string) --

        The status of the campaign.

        A campaign can be in one of the following states:

        • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED

        • DELETE PENDING > DELETE IN_PROGRESS

      • failureReason (string) --

        If a campaign fails, the reason behind the failure.

      • creationDateTime (datetime) --

        The date and time (in Unix format) that the campaign was created.

      • lastUpdatedDateTime (datetime) --

        The date and time (in Unix format) that the campaign was last updated.

      • latestCampaignUpdate (dict) --

        Provides a summary of the properties of a campaign update. For a complete listing, call the DescribeCampaign API.

        • solutionVersionArn (string) --

          The Amazon Resource Name (ARN) of the deployed solution version.

        • minProvisionedTPS (integer) --

          Specifies the requested minimum provisioned transactions (recommendations) per second that Amazon Personalize will support.

        • campaignConfig (dict) --

          The configuration details of a campaign.

          • itemExplorationConfig (dict) --

            A string to string map specifying the inference hyperparameters you wish to use for hyperparameter optimization. See customizing-solution-config-hpo.

            • (string) --

              • (string) --

        • status (string) --

          The status of the campaign update.

          A campaign update can be in one of the following states:

          • CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED

          • DELETE PENDING > DELETE IN_PROGRESS

        • failureReason (string) --

          If a campaign update fails, the reason behind the failure.

        • creationDateTime (datetime) --

          The date and time (in Unix time) that the campaign update was created.

        • lastUpdatedDateTime (datetime) --

          The date and time (in Unix time) that the campaign update was last updated.

UpdateCampaign (updated) Link ¶
Changes (request)
{'campaignConfig': {'itemExplorationConfig': {'string': 'string'}}}

Updates a campaign by either deploying a new solution or changing the value of the campaign's minProvisionedTPS parameter.

To update a campaign, the campaign status must be ACTIVE or CREATE FAILED. Check the campaign status using the DescribeCampaign API.

Note

You must wait until the status of the updated campaign is ACTIVE before asking the campaign for recommendations.

For more information on campaigns, see CreateCampaign.

See also: AWS API Documentation

Request Syntax

client.update_campaign(
    campaignArn='string',
    solutionVersionArn='string',
    minProvisionedTPS=123,
    campaignConfig={
        'itemExplorationConfig': {
            'string': 'string'
        }
    }
)
type campaignArn

string

param campaignArn

[REQUIRED]

The Amazon Resource Name (ARN) of the campaign.

type solutionVersionArn

string

param solutionVersionArn

The ARN of a new solution version to deploy.

type minProvisionedTPS

integer

param minProvisionedTPS

Specifies the requested minimum provisioned transactions (recommendations) per second that Amazon Personalize will support.

type campaignConfig

dict

param campaignConfig

The configuration details of a campaign.

  • itemExplorationConfig (dict) --

    A string to string map specifying the inference hyperparameters you wish to use for hyperparameter optimization. See customizing-solution-config-hpo.

    • (string) --

      • (string) --

rtype

dict

returns

Response Syntax

{
    'campaignArn': 'string'
}

Response Structure

  • (dict) --

    • campaignArn (string) --

      The same campaign ARN as given in the request.