Class 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 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) name
        numActiveControlBuckets - number of active control buckets
        numControlBuckets - total number of control buckets
        numActiveTreatmentBuckets - number of active treatment buckets
        numTreatmentBuckets - 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.