Changeset 13934


Ignore:
Timestamp:
06/23/16 12:13:49 (16 months ago)
Author:
mkommend
Message:

#2616: Added checks in percentile calculation when no valid values are present.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs

    r13508 r13934  
    165165      double percentile = double.NaN;
    166166      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    167         percentile = GetValuesWithoutNaN<double>(columnIndex).Quantile(0.25);
    168       } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    169         percentile = GetDateTimeAsSeconds(columnIndex).Quantile(0.25);
     167        percentile = GetValuesWithoutNaN<double>(columnIndex).DefaultIfEmpty(double.NaN).Quantile(0.25);
     168      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
     169        percentile = GetDateTimeAsSeconds(columnIndex).DefaultIfEmpty(double.NaN).Quantile(0.25);
    170170      }
    171171      return percentile;
     
    175175      double percentile = double.NaN;
    176176      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    177         percentile = GetValuesWithoutNaN<double>(columnIndex).Quantile(0.75);
    178       } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    179         percentile = GetDateTimeAsSeconds(columnIndex).Quantile(0.75);
     177        percentile = GetValuesWithoutNaN<double>(columnIndex).DefaultIfEmpty(double.NaN).Quantile(0.75);
     178      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
     179        percentile = GetDateTimeAsSeconds(columnIndex).DefaultIfEmpty(double.NaN).Quantile(0.75);
    180180      }
    181181      return percentile;
Note: See TracChangeset for help on using the changeset viewer.