Changeset 13151


Ignore:
Timestamp:
11/13/15 21:02:54 (4 years ago)
Author:
gkronber
Message:

#2491: merged r13034 and r13051 from trunk to stable branch

Location:
stable
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs

    r12725 r13151  
    313313        double stdDev = values.StandardDeviation();
    314314        double variance = values.Variance();
    315         double percentile25 = values.Percentile(0.25);
    316         double percentile75 = values.Percentile(0.75);
     315        double percentile25 = values.Quantile(0.25);
     316        double percentile75 = values.Quantile(0.75);
    317317        double lowerAvg = values.Count() > 4 ? values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average() : double.NaN;
    318318        double upperAvg = values.Count() > 4 ? values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average() : double.NaN;
  • stable/HeuristicLab.Analysis.Statistics.Views/3.3/SampleSizeInfluenceView.cs

    r12725 r13151  
    389389        matrix[5, i] = seriesValues.StandardDeviation();
    390390        matrix[6, i] = seriesValues.Variance();
    391         matrix[7, i] = seriesValues.Percentile(0.25);
    392         matrix[8, i] = seriesValues.Percentile(0.75);
     391        matrix[7, i] = seriesValues.Quantile(0.25);
     392        matrix[8, i] = seriesValues.Quantile(0.75);
    393393        matrix[9, i] = confIntervals.Item1;
    394394        matrix[10, i] = confIntervals.Item2;
  • stable/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs

    r13150 r13151  
    6565
    6666    // Numerical Recipes in C++, §8.5 Selecting the Mth Largest, O(n)
    67     // Giben k in [0..n-1] returns an array value from array arr[0..n-1] such that k array values are
     67    // Given k in [0..n-1] returns an array value from array arr[0..n-1] such that k array values are
    6868    // less than or equal to the one returned. The input array will be rearranged to have this value in
    6969    // location arr[k], with all smaller elements moved to arr[0..k-1] (in arbitrary order) and all
    7070    // larger elements in arr[k+1..n-1] (also in arbitrary order).
     71    //
     72    // Could be changed to Select<T> where T is IComparable but in this case is significantly slower for double values
    7173    private static double Select(int k, double[] arr) {
    7274      Contract.Assert(arr.GetLowerBound(0) == 0);
     
    198200    }
    199201
    200     /// <summary>
    201     /// Calculates the pth percentile of the values.
    202     /// </summary>
    203     public static double Percentile(this IEnumerable<double> values, double p) {
    204       // iterate only once
    205       double[] valuesArr = values.ToArray();
    206       int n = valuesArr.Length;
    207       if (n == 0) throw new InvalidOperationException("Enumeration contains no elements.");
    208       if (n == 1) return values.ElementAt(0);
    209 
    210       if (p.IsAlmost(0.0)) return valuesArr[0];
    211       if (p.IsAlmost(1.0)) return valuesArr[n - 1];
    212 
    213       double t = p * (n - 1);
    214       int index = (int)Math.Floor(t);
    215       double percentage = t - index;
    216       return valuesArr[index] * (1 - percentage) + valuesArr[index + 1] * percentage;
    217     }
    218 
    219202    public static IEnumerable<double> LimitToRange(this IEnumerable<double> values, double min, double max) {
    220203      if (min > max) throw new ArgumentException(string.Format("Minimum {0} is larger than maximum {1}.", min, max));
  • stable/HeuristicLab.DataPreprocessing/3.4

  • stable/HeuristicLab.DataPreprocessing/3.4/Implementations/StatisticsLogic.cs

    r13149 r13151  
    166166      double percentile = double.NaN;
    167167      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    168         percentile = GetValuesWithoutNaN<double>(columnIndex).Percentile(0.25);
    169       } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    170         percentile = GetDateTimeAsSeconds(columnIndex).Percentile(0.25);
     168        percentile = GetValuesWithoutNaN<double>(columnIndex).Quantile(0.25);
     169      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
     170        percentile = GetDateTimeAsSeconds(columnIndex).Quantile(0.25);
    171171      }
    172172      return percentile;
     
    176176      double percentile = double.NaN;
    177177      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    178         percentile = GetValuesWithoutNaN<double>(columnIndex).Percentile(0.75);
    179       } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    180         percentile = GetDateTimeAsSeconds(columnIndex).Percentile(0.75);
     178        percentile = GetValuesWithoutNaN<double>(columnIndex).Quantile(0.75);
     179      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
     180        percentile = GetDateTimeAsSeconds(columnIndex).Quantile(0.75);
    181181      }
    182182      return percentile;
  • stable/HeuristicLab.Optimization.Views

  • stable/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs

    r13144 r13151  
    248248        matrix[5, i] = seriesValues.StandardDeviation();
    249249        matrix[6, i] = seriesValues.Variance();
    250         matrix[7, i] = seriesValues.Percentile(0.25);
    251         matrix[8, i] = seriesValues.Percentile(0.75);
     250        matrix[7, i] = seriesValues.Quantile(0.25);
     251        matrix[8, i] = seriesValues.Quantile(0.75);
    252252      }
    253253      statisticsMatrixView.Content = matrix;
Note: See TracChangeset for help on using the changeset viewer.