Changeset 18086 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis/3.4/DatasetExtensions.cs
- Timestamp:
- 11/19/21 16:07:45 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis/3.4/DatasetExtensions.cs
r17226 r18086 96 96 } 97 97 98 public static IntervalCollection GetVariableRanges(this IDataset dataset, bool ignoreNaNs = true) { 99 IntervalCollection variableRanges = new IntervalCollection(); 100 foreach (var variable in dataset.DoubleVariables) { // ranges can only be calculated for double variables 101 var values = dataset.GetDoubleValues(variable); 102 103 if (ignoreNaNs) { 104 values = values.Where(v => !double.IsNaN(v)); 105 106 if (!values.Any()) { //handle values with only NaNs explicitly 107 var emptyInterval = new Interval(double.NaN, double.NaN); 108 variableRanges.AddInterval(variable, emptyInterval); 109 continue; 110 } 111 } 112 113 var interval = Interval.GetInterval(values); 114 variableRanges.AddInterval(variable, interval); 115 } 116 117 return variableRanges; 118 } 119 98 120 public static IEnumerable<KeyValuePair<string, IEnumerable<string>>> GetFactorVariableValues( 99 121 this IDataset ds, IEnumerable<string> factorVariables, IEnumerable<int> rows) {
Note: See TracChangeset
for help on using the changeset viewer.