Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/27/21 14:23:28 (3 years ago)
Author:
dpiringe
Message:

#3026

  • fixed the injection of VariableRanges in RegressionProblemDataConverter (now: the entries in IntervalCollection get replaced instead of the whole collection object)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs

    r18031 r18033  
    171171
    172172    private void SetVariableRanges(dynamic regressionProblemData, DoubleMatrixJsonItem item) {
    173       // TODO
    174       if (item != null) {
    175         object variableRanges = (object)regressionProblemData.VariableRanges; //IRegressionProblemData.cs
    176         IntervalCollection collection = new IntervalCollection();
     173      if (item != null) {
     174        IntervalCollection variableRanges = (IntervalCollection)regressionProblemData.VariableRanges;
     175
     176        foreach(var kvp in variableRanges.GetDictionary()) {
     177          variableRanges.DeleteInterval(kvp.Key);
     178        }
     179       
    177180        int count = 0;
    178181        foreach (var column in item.ColumnNames) {
    179           collection.AddInterval(column, new Interval(item.Value[count].Min(), item.Value[count].Max()));
     182          var doubleValuesForColumn = item.Value[count];
     183          if (doubleValuesForColumn.Any(x => double.IsNaN(x))) // add a NaN interval if any NaN value exists
     184            variableRanges.AddInterval(column, new Interval(double.NaN, double.NaN));
     185          else
     186            variableRanges.AddInterval(column, new Interval(doubleValuesForColumn.Min(), doubleValuesForColumn.Max()));
    180187          count++;
    181188        }
    182 
    183         var variableRangesInfo = regressionProblemData.GetType().GetField(VariableRanges, flags);
    184         variableRangesInfo.SetValue(regressionProblemData, collection);
    185189      }
    186190    }
Note: See TracChangeset for help on using the changeset viewer.