Package ai.promoted.delivery.client
Class TwoArmExperiment
java.lang.Object
ai.promoted.delivery.client.TwoArmExperiment
Represents a two arm Experiment configuration.
WARNING - while ramping up an experiment, do not change
numControlBuckets or numTreatmentBuckets. This will
likely produce bad results.
For the buckets, the treatment buckets are after the
control buckets.
-
Constructor Summary
ConstructorsConstructorDescriptionTwoArmExperiment(String cohortId, int numActiveControlBuckets, int numControlBuckets, int numActiveTreatmentBuckets, int numTreatmentBuckets) Creates a two-arm experiment config with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptioncheckMembership(String userId) Evaluates the experiment membership for a given user.static TwoArmExperimentcreate5050TwoArmExperimentConfig(String cohortId, int controlPercent, int treatmentPercent) Factory method for a 50/50 experiment.intintintint
-
Constructor Details
-
TwoArmExperiment
public TwoArmExperiment(String cohortId, int numActiveControlBuckets, int numControlBuckets, int numActiveTreatmentBuckets, int numTreatmentBuckets) Creates a two-arm experiment config with the given parameters.- Parameters:
cohortId- the cohort (experiment) namenumActiveControlBuckets- number of active control bucketsnumControlBuckets- total number of control bucketsnumActiveTreatmentBuckets- number of active treatment bucketsnumTreatmentBuckets- total number of treatment buckets
-
-
Method Details
-
create5050TwoArmExperimentConfig
public static TwoArmExperiment create5050TwoArmExperimentConfig(String cohortId, int controlPercent, int treatmentPercent) Factory method for a 50/50 experiment.- Parameters:
cohortId- name of the cohort id (experiment)controlPercent- percent of the total to activate into control, range [0, 50]treatmentPercent- percent of the total to activate into treatment, range [0, 50]- Returns:
- the configured experiment
-
getCohortId
-
getNumActiveControlBuckets
public int getNumActiveControlBuckets() -
getNumControlBuckets
public int getNumControlBuckets() -
getNumActiveTreatmentBuckets
public int getNumActiveTreatmentBuckets() -
getNumTreatmentBuckets
public int getNumTreatmentBuckets() -
checkMembership
Evaluates the experiment membership for a given user.- Parameters:
userId- the user id to check- Returns:
- the correct cohort membership if the user is activated into the experiment, or null if not.
-