CloudWatchEvidently / Client / create_experiment

create_experiment#

CloudWatchEvidently.Client.create_experiment(**kwargs)#

Creates an Evidently experiment. Before you create an experiment, you must create the feature to use for the experiment.

An experiment helps you make feature design decisions based on evidence and data. An experiment can test as many as five variations at once. Evidently collects experiment data and analyzes it by statistical methods, and provides clear recommendations about which variations perform better.

You can optionally specify a segment to have the experiment consider only certain audience types in the experiment, such as using only user sessions from a certain location or who use a certain internet browser.

Don’t use this operation to update an existing experiment. Instead, use UpdateExperiment.

See also: AWS API Documentation

Request Syntax

response = client.create_experiment(
    description='string',
    metricGoals=[
        {
            'desiredChange': 'INCREASE'|'DECREASE',
            'metricDefinition': {
                'entityIdKey': 'string',
                'eventPattern': 'string',
                'name': 'string',
                'unitLabel': 'string',
                'valueKey': 'string'
            }
        },
    ],
    name='string',
    onlineAbConfig={
        'controlTreatmentName': 'string',
        'treatmentWeights': {
            'string': 123
        }
    },
    project='string',
    randomizationSalt='string',
    samplingRate=123,
    segment='string',
    tags={
        'string': 'string'
    },
    treatments=[
        {
            'description': 'string',
            'feature': 'string',
            'name': 'string',
            'variation': 'string'
        },
    ]
)
Parameters:
  • description (string) – An optional description of the experiment.

  • metricGoals (list) –

    [REQUIRED]

    An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.

    • (dict) –

      Use this structure to tell Evidently whether higher or lower values are desired for a metric that is used in an experiment.

      • desiredChange (string) –

        INCREASE means that a variation with a higher number for this metric is performing better.

        DECREASE means that a variation with a lower number for this metric is performing better.

      • metricDefinition (dict) – [REQUIRED]

        A structure that contains details about the metric.

        • entityIdKey (string) – [REQUIRED]

          The entity, such as a user or session, that does an action that causes a metric value to be recorded. An example is userDetails.userID.

        • eventPattern (string) –

          The EventBridge event pattern that defines how the metric is recorded.

          For more information about EventBridge event patterns, see Amazon EventBridge event patterns.

        • name (string) – [REQUIRED]

          A name for the metric.

        • unitLabel (string) –

          A label for the units that the metric is measuring.

        • valueKey (string) – [REQUIRED]

          The value that is tracked to produce the metric.

  • name (string) –

    [REQUIRED]

    A name for the new experiment.

  • onlineAbConfig (dict) –

    A structure that contains the configuration of which variation to use as the “control” version. tThe “control” version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.

    • controlTreatmentName (string) –

      The name of the variation that is to be the default variation that the other variations are compared to.

    • treatmentWeights (dict) –

      A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. Specify the traffic portion in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.

      • (string) –

        • (integer) –

  • project (string) –

    [REQUIRED]

    The name or ARN of the project that you want to create the new experiment in.

  • randomizationSalt (string) – When Evidently assigns a particular user session to an experiment, it must use a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and randomizationSalt. If you omit randomizationSalt, Evidently uses the experiment name as the randomizationSalt.

  • samplingRate (integer) –

    The portion of the available audience that you want to allocate to this experiment, in thousandths of a percent. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.

    This is represented in thousandths of a percent. For example, specify 10,000 to allocate 10% of the available audience.

  • segment (string) – Specifies an audience segment to use in the experiment. When a segment is used in an experiment, only user sessions that match the segment pattern are used in the experiment.

  • tags (dict) –

    Assigns one or more tags (key-value pairs) to the experiment.

    Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.

    Tags don’t have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.

    You can associate as many as 50 tags with an experiment.

    For more information, see Tagging Amazon Web Services resources.

    • (string) –

      • (string) –

  • treatments (list) –

    [REQUIRED]

    An array of structures that describe the configuration of each feature variation used in the experiment.

    • (dict) –

      A structure that defines one treatment in an experiment. A treatment is a variation of the feature that you are including in the experiment.

      • description (string) –

        A description for this treatment.

      • feature (string) – [REQUIRED]

        The feature that this experiment is testing.

      • name (string) – [REQUIRED]

        A name for this treatment.

      • variation (string) – [REQUIRED]

        The name of the variation to use as this treatment in the experiment.

Return type:

dict

Returns:

Response Syntax

{
    'experiment': {
        'arn': 'string',
        'createdTime': datetime(2015, 1, 1),
        'description': 'string',
        'execution': {
            'endedTime': datetime(2015, 1, 1),
            'startedTime': datetime(2015, 1, 1)
        },
        'lastUpdatedTime': datetime(2015, 1, 1),
        'metricGoals': [
            {
                'desiredChange': 'INCREASE'|'DECREASE',
                'metricDefinition': {
                    'entityIdKey': 'string',
                    'eventPattern': 'string',
                    'name': 'string',
                    'unitLabel': 'string',
                    'valueKey': 'string'
                }
            },
        ],
        'name': 'string',
        'onlineAbDefinition': {
            'controlTreatmentName': 'string',
            'treatmentWeights': {
                'string': 123
            }
        },
        'project': 'string',
        'randomizationSalt': 'string',
        'samplingRate': 123,
        'schedule': {
            'analysisCompleteTime': datetime(2015, 1, 1)
        },
        'segment': 'string',
        'status': 'CREATED'|'UPDATING'|'RUNNING'|'COMPLETED'|'CANCELLED',
        'statusReason': 'string',
        'tags': {
            'string': 'string'
        },
        'treatments': [
            {
                'description': 'string',
                'featureVariations': {
                    'string': 'string'
                },
                'name': 'string'
            },
        ],
        'type': 'aws.evidently.onlineab'
    }
}

Response Structure

  • (dict) –

    • experiment (dict) –

      A structure containing the configuration details of the experiment that you created.

      • arn (string) –

        The ARN of the experiment.

      • createdTime (datetime) –

        The date and time that the experiment is first created.

      • description (string) –

        A description of the experiment.

      • execution (dict) –

        A structure that contains the date and time that the experiment started and ended.

        • endedTime (datetime) –

          The date and time that the experiment ended.

        • startedTime (datetime) –

          The date and time that the experiment started.

      • lastUpdatedTime (datetime) –

        The date and time that the experiment was most recently updated.

      • metricGoals (list) –

        An array of structures that defines the metrics used for the experiment, and whether a higher or lower value for each metric is the goal.

        • (dict) –

          A structure that tells Evidently whether higher or lower values are desired for a metric that is used in an experiment.

          • desiredChange (string) –

            INCREASE means that a variation with a higher number for this metric is performing better.

            DECREASE means that a variation with a lower number for this metric is performing better.

          • metricDefinition (dict) –

            A structure that contains details about the metric.

            • entityIdKey (string) –

              The entity, such as a user or session, that does an action that causes a metric value to be recorded.

            • eventPattern (string) –

              The EventBridge event pattern that defines how the metric is recorded.

              For more information about EventBridge event patterns, see Amazon EventBridge event patterns.

            • name (string) –

              The name of the metric.

            • unitLabel (string) –

              The label for the units that the metric is measuring.

            • valueKey (string) –

              The value that is tracked to produce the metric.

      • name (string) –

        The name of the experiment.

      • onlineAbDefinition (dict) –

        A structure that contains the configuration of which variation to use as the “control” version. The “control” version is used for comparison with other variations. This structure also specifies how much experiment traffic is allocated to each variation.

        • controlTreatmentName (string) –

          The name of the variation that is the default variation that the other variations are compared to.

        • treatmentWeights (dict) –

          A set of key-value pairs. The keys are variation names, and the values are the portion of experiment traffic to be assigned to that variation. The traffic portion is specified in thousandths of a percent, so 20,000 for a variation would allocate 20% of the experiment traffic to that variation.

          • (string) –

            • (integer) –

      • project (string) –

        The name or ARN of the project that contains this experiment.

      • randomizationSalt (string) –

        This value is used when Evidently assigns a particular user session to the experiment. It helps create a randomization ID to determine which variation the user session is served. This randomization ID is a combination of the entity ID and randomizationSalt.

      • samplingRate (integer) –

        In thousandths of a percent, the amount of the available audience that is allocated to this experiment. The available audience is the total audience minus the audience that you have allocated to overrides or current launches of this feature.

        This is represented in thousandths of a percent, so a value of 10,000 is 10% of the available audience.

      • schedule (dict) –

        A structure that contains the time and date that Evidently completed the analysis of the experiment.

        • analysisCompleteTime (datetime) –

          The time and date that Evidently completed the analysis of the experiment.

      • segment (string) –

        The audience segment being used for the experiment, if a segment is being used.

      • status (string) –

        The current state of the experiment.

      • statusReason (string) –

        If the experiment was stopped, this is the string that was entered by the person who stopped the experiment, to explain why it was stopped.

      • tags (dict) –

        The list of tag keys and values associated with this experiment.

        • (string) –

          • (string) –

      • treatments (list) –

        An array of structures that describe the configuration of each feature variation used in the experiment.

        • (dict) –

          A structure that defines one treatment in an experiment. A treatment is a variation of the feature that you are including in the experiment.

          • description (string) –

            The description of the treatment.

          • featureVariations (dict) –

            The feature variation used for this treatment. This is a key-value pair. The key is the feature name, and the value is the variation name.

            • (string) –

              • (string) –

          • name (string) –

            The name of this treatment.

      • type (string) –

        The type of this experiment. Currently, this value must be aws.experiment.onlineab.

Exceptions

  • CloudWatchEvidently.Client.exceptions.ValidationException

  • CloudWatchEvidently.Client.exceptions.ConflictException

  • CloudWatchEvidently.Client.exceptions.ServiceQuotaExceededException

  • CloudWatchEvidently.Client.exceptions.ResourceNotFoundException

  • CloudWatchEvidently.Client.exceptions.AccessDeniedException