public Builder withBucketCounts(BucketCounts value) { this.item.label = value.getLabel(); this.item.impressionCounts = value.getImpressionCounts(); this.item.jointActionCounts = value.getJointActionCounts(); this.item.actionCounts = value.getActionCounts(); return this; }
public Builder withBucketCounts(BucketCounts value) { this.item.label = value.getLabel(); this.item.impressionCounts = value.getImpressionCounts(); this.item.jointActionCounts = value.getJointActionCounts(); this.item.actionCounts = value.getActionCounts(); return this; }
/** * Creates a list of BucketStatistics objects from a list of BucketCounts objects. * * @param buckets a complete list of BucketCounts for this experiment * @param metric the binomial metric to use for statistics calculations * @param effectSize the effect size of interest to use for statistics calculations * @return Map of bucket label and bucket stats */ Map<Bucket.Label, BucketStatistics> calculateBucketStatistics(Map<Bucket.Label, BucketCounts> buckets, BinomialMetric metric, double effectSize, Parameters.Mode mode) { Map<Bucket.Label, BucketStatistics> bucketsWithStats = new HashMap<>(); for (BucketCounts bucket : buckets.values()) { Bucket.Label bucketLabel = bucket.getLabel(); BucketStatistics bucketWithStats = new BucketStatistics.Builder() .withBucketCounts(bucket) .withBucketComparisons(new HashMap<Bucket.Label, BucketComparison>()) .build(); analysisTools.generateRate(bucketWithStats, metric); bucketsWithStats.put(bucketLabel, bucketWithStats); } analysisTools.generateBucketComparison(bucketsWithStats, metric, effectSize, mode); return bucketsWithStats; }
/** * {@inheritDoc} */ @Override public ExperimentCounts calculateExperimentCounts(Collection<BucketCounts> bucketsSet) { Map<Bucket.Label, BucketCounts> buckets = new HashMap<>(); for (BucketCounts bucket : bucketsSet) { buckets.put(bucket.getLabel(), bucket); } Counts jointActionCounts = new Counts(0, 0); Counts impressionCounts = new Counts(0, 0); Map<Event.Name, ActionCounts> experimentActionCounts = new HashMap<>(); for (BucketCounts bucket : bucketsSet) { jointActionCounts.addCount(bucket.getJointActionCounts()); impressionCounts.addCount(bucket.getImpressionCounts()); Map<Event.Name, ActionCounts> bucketActionCounts = bucket.getActionCounts(); for (ActionCounts bucketCounts : bucketActionCounts.values()) { Event.Name actionName = bucketCounts.getActionName(); ActionCounts currentExperimentCounts = experimentActionCounts.get(actionName); if (currentExperimentCounts == null) { experimentActionCounts.put(actionName, bucketCounts.clone()); } else { currentExperimentCounts.addCount(bucketCounts); } } } return new ExperimentCounts.Builder().withActionCounts(experimentActionCounts).withBuckets(buckets) .withImpressionCounts(impressionCounts).withJointActionCounts(jointActionCounts) .build(); }
.withBucketCounts(bucket) .build(); Bucket.Label bucketLabel = bucket.getLabel(); analysisTools.generateRate(bucketWithStats, metric); bucketsWithStats.put(bucketLabel, bucketWithStats);