baseplate.experiments.providers.r2

Classes

class baseplate.experiments.providers.r2.R2Experiment(id, name, owner, variants, seed=None, bucket_val='user_id', targeting=None, overrides=None, newer_than=None, version=None)

A “legacy”, r2-style experiment.

Deprecated since version 0.27: Use SimpleExperiment with SingleVariantSet or MultiVariantSet instead.

Should log bucketing events to the event pipeline.

Note that this style of experiment caps the size of your variants such that:

def max_variant_size(variant_size, num_variants):
    return max(variant_size, (1/num_variants) * 100)

The config dict is expected to have the following values:

  • variants: dict mapping variant names to their sizes. Variant sizes are expressed as numeric percentages rather than a fraction of 1 (that is, 1.5 means 1.5%, not 150%).
  • targeting: (Optional) dict that maps the names of targeting parameters to lists of valid values. When determining the variant of an experiment, the targeting parameters you want to use are passed in as keyword arguments to the call to experiment.variant.
  • overrides: (Optional) dict that maps override parameters to dictionaries mapping values to the variant name you want to override the variant to. When determining the variant of an experiment, the override parameters you want to use are passed in as keyword arguments to the call to experiment.variant.
  • bucket_val: (Optional) Name of the parameter you want to use for bucketing. This value must be passed to the call to experiment.variant as a keyword argument. Defaults to “user_id”.
  • seed: (Optional) Overrides the seed for this experiment. If this is not set, name is used as the seed.
  • newer_than: (Optional) The earliest time that a bucketing resource can have been created by in UTC epoch seconds. If set, you must pass the time, in UTC epoch seconds, when the resource that you are bucketing was created to the call to experiment.variant as the “created” parameter. For example, if you are bucketing based on user_id, created would be set to the time when a User account was created or when an LoID cookie was generated.