create_metric_attribution

create_metric_attribution(**kwargs)

Creates a metric attribution. A metric attribution creates reports on the data that you import into Amazon Personalize. Depending on how you imported the data, you can view reports in Amazon CloudWatch or Amazon S3. For more information, see Measuring impact of recommendations.

See also: AWS API Documentation

Request Syntax

response = client.create_metric_attribution(
    name='string',
    datasetGroupArn='string',
    metrics=[
        {
            'eventType': 'string',
            'metricName': 'string',
            'expression': 'string'
        },
    ],
    metricsOutputConfig={
        's3DataDestination': {
            'path': 'string',
            'kmsKeyArn': 'string'
        },
        'roleArn': 'string'
    }
)
Parameters
  • name (string) --

    [REQUIRED]

    A name for the metric attribution.

  • datasetGroupArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the destination dataset group for the metric attribution.

  • metrics (list) --

    [REQUIRED]

    A list of metric attributes for the metric attribution. Each metric attribute specifies an event type to track and a function. Available functions are SUM() or SAMPLECOUNT() . For SUM() functions, provide the dataset type (either Interactions or Items) and column to sum as a parameter. For example SUM(Items.PRICE).

    • (dict) --

      Contains information on a metric that a metric attribution reports on. For more information, see Measuring impact of recommendations.

      • eventType (string) -- [REQUIRED]

        The metric's event type.

      • metricName (string) -- [REQUIRED]

        The metric's name. The name helps you identify the metric in Amazon CloudWatch or Amazon S3.

      • expression (string) -- [REQUIRED]

        The attribute's expression. Available functions are SUM() or SAMPLECOUNT() . For SUM() functions, provide the dataset type (either Interactions or Items) and column to sum as a parameter. For example SUM(Items.PRICE).

  • metricsOutputConfig (dict) --

    [REQUIRED]

    The output configuration details for the metric attribution.

    • s3DataDestination (dict) --

      The configuration details of an Amazon S3 input or output bucket.

      • path (string) -- [REQUIRED]

        The file path of the Amazon S3 bucket.

      • kmsKeyArn (string) --

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

    • roleArn (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of the IAM service role that has permissions to add data to your output Amazon S3 bucket and add metrics to Amazon CloudWatch. For more information, see Measuring impact of recommendations.

Return type

dict

Returns

Response Syntax

{
    'metricAttributionArn': 'string'
}

Response Structure

  • (dict) --

    • metricAttributionArn (string) --

      The Amazon Resource Name (ARN) for the new metric attribution.

Exceptions

  • Personalize.Client.exceptions.InvalidInputException
  • Personalize.Client.exceptions.ResourceNotFoundException
  • Personalize.Client.exceptions.ResourceAlreadyExistsException
  • Personalize.Client.exceptions.ResourceInUseException
  • Personalize.Client.exceptions.LimitExceededException