Package ai.promoted.delivery.client
Class TwoArmExperiment
- java.lang.Object
-
- ai.promoted.delivery.client.TwoArmExperiment
-
public class TwoArmExperiment extends Object
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
Constructors Constructor Description TwoArmExperiment(String cohortId, int numActiveControlBuckets, int numControlBuckets, int numActiveTreatmentBuckets, int numTreatmentBuckets)Creates a two-arm experiment config with the given parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CohortMembershipcheckMembership(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.StringgetCohortId()intgetNumActiveControlBuckets()intgetNumActiveTreatmentBuckets()intgetNumControlBuckets()intgetNumTreatmentBuckets()
-
-
-
Constructor Detail
-
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 Detail
-
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
public String getCohortId()
-
getNumActiveControlBuckets
public int getNumActiveControlBuckets()
-
getNumControlBuckets
public int getNumControlBuckets()
-
getNumActiveTreatmentBuckets
public int getNumActiveTreatmentBuckets()
-
getNumTreatmentBuckets
public int getNumTreatmentBuckets()
-
checkMembership
public CohortMembership checkMembership(String userId)
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.
-
-