- Timestamp:
- 07/14/16 22:41:02 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13934-13935
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing/3.4 merged: 13934-13935
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs
r13508 r14077 71 71 } 72 72 73 public T GetMin<T>(int columnIndex, bool considerSelection = false) where T : IComparable<T> {74 var min = default (T);73 public T GetMin<T>(int columnIndex, T defaultValue, bool considerSelection = false) where T : IComparable<T> { 74 var min = defaultValue; 75 75 if (preprocessingData.VariableHasType<T>(columnIndex)) { 76 76 var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection); … … 82 82 } 83 83 84 public T GetMax<T>(int columnIndex, bool considerSelection = false) where T : IComparable<T> {85 var max = default (T);84 public T GetMax<T>(int columnIndex, T defaultValue, bool considerSelection = false) where T : IComparable<T> { 85 var max = defaultValue; 86 86 if (preprocessingData.VariableHasType<T>(columnIndex)) { 87 87 var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection); … … 131 131 } 132 132 133 public T GetMostCommonValue<T>(int columnIndex, bool considerSelection = false) {133 public T GetMostCommonValue<T>(int columnIndex, T defaultValue, bool considerSelection = false) { 134 134 var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection); 135 135 if (!values.Any()) 136 return default (T);136 return defaultValue; 137 137 return values.GroupBy(x => x) 138 138 .OrderByDescending(g => g.Count()) … … 165 165 double percentile = double.NaN; 166 166 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); 170 170 } 171 171 return percentile; … … 175 175 double percentile = double.NaN; 176 176 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); 180 180 } 181 181 return percentile;
Note: See TracChangeset
for help on using the changeset viewer.