Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/19/18 14:50:56 (6 years ago)
Author:
chaider
Message:

#2966: Merged branch changes into trunk.

Location:
trunk/HeuristicLab.Problems.DataAnalysis
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis

  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/DatasetUtil.cs

    r15583 r16407  
    9393    }
    9494
     95    public static Dictionary<string, Interval> GetVariableRanges(IDataset dataset, IEnumerable<int> rows = null) {
     96      Dictionary<string, Interval> variableRanges = new Dictionary<string, Interval>();
     97
     98      foreach (var variable in dataset.VariableNames) {
     99        IEnumerable<double> values = null;
     100
     101        if (rows == null) values = dataset.GetDoubleValues(variable);
     102        else values = dataset.GetDoubleValues(variable, rows);
     103
     104        var range = Interval.GetInterval(values);
     105        variableRanges.Add(variable, range);
     106      }
     107
     108      return variableRanges;
     109    }
     110
    95111    private static bool GetEqualValues(this Dictionary<ValuesType, ValuesType> variableValuesMapping, ValuesType originalValues, out ValuesType matchingValues) {
    96112      if (variableValuesMapping.ContainsKey(originalValues)) {
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r15638 r16407  
    140140    <Compile Include="Implementation\ConstantModel.cs" />
    141141    <Compile Include="Implementation\DataAnalysisModel.cs" />
     142    <Compile Include="Implementation\Interval.cs" />
    142143    <Compile Include="Implementation\Regression\ConfidenceBoundRegressionSolution.cs" />
    143144    <Compile Include="Implementation\Regression\ConstantRegressionModel.cs" />
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs

    r16405 r16407  
    5454
    5555    public static Interval GetInterval(IEnumerable<double> values) {
    56       if (values == null) throw new ArgumentNullException("The given value set is not defined.");
    57       if (!values.Any()) throw new ArgumentException($"No valid values are present.");
     56      if (values == null) throw new ArgumentNullException("values");
     57      if (!values.Any()) throw new ArgumentException($"No values are present.");
    5858
    5959      var min = double.MaxValue;
     
    7676        return false;
    7777
    78       return this.UpperBound.IsAlmost(other.UpperBound) && this.LowerBound.IsAlmost(other.LowerBound);
     78      return (UpperBound.IsAlmost(other.UpperBound) || (double.IsNaN(UpperBound) && double.IsNaN(other.UpperBound)))
     79        && (LowerBound.IsAlmost(other.LowerBound) || (double.IsNaN(LowerBound) && double.IsNaN(other.LowerBound)));
    7980    }
    8081
Note: See TracChangeset for help on using the changeset viewer.