Changeset 15785


Ignore:
Timestamp:
02/19/18 16:32:54 (18 months ago)
Author:
fholzing
Message:

#2383: Added additional filtering logic for double.NaN and double.Inf

Location:
trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartViewBase.cs

    r15583 r15785  
    7272        this.chart.Series[TARGETVARIABLE_SERIES_NAME].LegendText = TARGETVARIABLE_SERIES_NAME;
    7373        this.chart.Series[TARGETVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    74         this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(),
    75           Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray());
     74
     75        var rows = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray();
     76        var targetVariables = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray();
     77        List<int> xVals = new List<int>();
     78        List<double> yVals = new List<double>();
     79
     80        for (int i = 0; i < rows.Length; i++) {
     81          if (!double.IsInfinity(targetVariables[i])) {
     82            xVals.Add(rows[i]);
     83            yVals.Add(targetVariables[i]);
     84          }
     85        }
     86
     87        this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(xVals.ToArray(), yVals.ToArray());
    7688        // training series
    7789        this.chart.Series.Add(ESTIMATEDVALUES_TRAINING_SERIES_NAME);
     
    161173      var targetValues = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
    162174      double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min();
    163       double targetValuesRange = targetValues.Max() - targetValues.Min();
     175      double targetValuesRange = targetValues.Where(v => !double.IsInfinity(v)).Max() - targetValues.Where(v => !double.IsNaN(v) && !double.IsNegativeInfinity(v)).Min();
    164176      double interestingValuesRange = Math.Min(Math.Max(targetValuesRange, 1.0), Math.Max(estimatedValuesRange, 1.0));
    165177      double digits = (int)Math.Log10(interestingValuesRange) - 3;
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.cs

    r15583 r15785  
    8181      if (Content != null) {
    8282        List<double> residuals = CalculateResiduals(Content);
     83        residuals.Remove(double.NaN);
     84        residuals.Remove(double.PositiveInfinity);
     85        residuals.Remove(double.NegativeInfinity);
    8386
    8487        double max = 0.0;
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs

    r15583 r15785  
    3838      var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, idx).ToArray();
    3939      for (int i = 0; i < idx.Length; i++) {
    40         x[i] = target[i] - x[i];
     40        if (!double.IsInfinity(target[i])) {
     41          x[i] = target[i] - x[i];
     42        }
    4143      }
    4244    }
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r15583 r15785  
    166166          this.chart.Series[TEST_SERIES].Points.DataBindXY(dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndices).ToArray(), "",
    167167            Content.EstimatedTestValues.ToArray(), "");
    168         double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Max();
    169         double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Min();
     168        double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Where(v => !double.IsInfinity(v)).Max();
     169        double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Where(v => !double.IsNaN(v) && !double.IsNegativeInfinity(v)).Min();
    170170
    171171        double axisMin, axisMax, axisInterval;
Note: See TracChangeset for help on using the changeset viewer.