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;
 }
Exemple #2
0
        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 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;
 }