public AggregationOperationResult Do(IList<double> input) { if (input == null) throw new ArgumentNullException("input"); if (!input.Any()) throw new InvalidOperationException("No elements to aggregate"); double first = input.First(); AggregationOperationResult result = new AggregationOperationResult(AggregationType.Percentile); IOrderedEnumerable<double> sortedData = input.OrderBy(i => i); _percents.ForEach(pp => result.Add(pp.ToString(CultureInfo.InvariantCulture), Percentile(sortedData, pp))); return result; }
public AggregationOperationResult Do(IList <double> input) { if (input == null) { throw new ArgumentNullException("input"); } if (!input.Any()) { throw new InvalidOperationException("No elements to aggregate"); } double first = input.First(); AggregationOperationResult result = new AggregationOperationResult(AggregationType.Percentile); IOrderedEnumerable <double> sortedData = input.OrderBy(i => i); _percents.ForEach(pp => result.Add(pp.ToString(CultureInfo.InvariantCulture), Percentile(sortedData, pp))); return(result); }
public AggregationOperationResult Do(IList <double> input) { if (input == null) { throw new ArgumentNullException("input"); } if (!input.Any()) { throw new InvalidOperationException("No elements to aggregate"); } double first = input.First(); AggregationOperationResult result = new AggregationOperationResult(AggregationType.ValueDistributionGroups); int totalCount = input.Count; _distributionGroups.ForEach( dg => result.Add(dg.AsKey, (input.Count(i => i >= dg.LowerBound && i < dg.UpperBound) / totalCount) * 100)); return(result); }
public void AddResult(AggregationOperationResult value) { switch (value.AggregationType) { case AggregationType.Max: Max = value.Value[0].Value; break; case AggregationType.Min: Min = value.Value[0].Value; break; case AggregationType.Avg: Avg = value.Value[0].Value; break; case AggregationType.Count: Count = (int) value.Value[0].Value; break; case AggregationType.Percentile: Percentiles = value.Value.ToDictionary(e => e.Key, e=>e.Value); break; case AggregationType.ValueDistributionGroups: DistributionGroups = value.Value.ToDictionary(e => e.Key, e => e.Value); break; } }
public AggregationOperationResult Do(IList<double> input) { if (input == null) throw new ArgumentNullException("input"); if (!input.Any()) throw new InvalidOperationException("No elements to aggregate"); double first = input.First(); AggregationOperationResult result = new AggregationOperationResult(AggregationType.ValueDistributionGroups); int totalCount = input.Count; _distributionGroups.ForEach( dg => result.Add(dg.AsKey, (input.Count(i => i >= dg.LowerBound && i < dg.UpperBound)/totalCount)*100)); return result; }