Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16363


Ignore:
Timestamp:
12/11/18 13:09:04 (6 years ago)
Author:
chaider
Message:

#2966: Added GetVariableBoundaries method in DatasetUtil

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2966_interval_calculation/HeuristicLab.Problems.DataAnalysis/3.4/DatasetUtil.cs

    r15583 r16363  
    9393    }
    9494
     95    public static Dictionary<string, Interval> GetVariableBoundaries(IDataset dataset) {
     96      Dictionary<string, Interval> variableBoundaries = new Dictionary<string, Interval>();
     97
     98      foreach (var variable in dataset.VariableNames) {
     99        var min = double.MaxValue;
     100        var max = double.MinValue;
     101
     102        foreach (var val in dataset.GetDoubleValues(variable)) {
     103          if (val < min) min = val;
     104          if (val > max) max = val;
     105        }
     106        variableBoundaries.Add(variable, new Interval(min, max));
     107      }
     108
     109      return variableBoundaries;
     110    }
     111
    95112    private static bool GetEqualValues(this Dictionary<ValuesType, ValuesType> variableValuesMapping, ValuesType originalValues, out ValuesType matchingValues) {
    96113      if (variableValuesMapping.ContainsKey(originalValues)) {
Note: See TracChangeset for help on using the changeset viewer.