Changeset 15811 for stable


Ignore:
Timestamp:
02/23/18 17:03:57 (20 months ago)
Author:
gkronber
Message:

#2383: merged r15785,r15787,r15789,r15790,r15793,r15810 from trunk to stable

Location:
stable
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionErrorCharacteristicsCurveView.cs

    r15584 r15811  
    2323using System.Collections;
    2424using System.Collections.Generic;
    25 using System.Diagnostics.Contracts;
    2625using System.Linq;
    2726using HeuristicLab.Algorithms.DataAnalysis;
  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r15584 r15811  
    249249    protected virtual List<double> GetResiduals(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues) {
    250250      switch (residualComboBox.SelectedItem.ToString()) {
    251         case "Absolute error": return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y)).ToList();
    252         case "Squared error": return originalValues.Zip(estimatedValues, (x, y) => (x - y) * (x - y)).ToList();
    253         case "Relative error": return originalValues.Zip(estimatedValues, (x, y) => x.IsAlmost(0.0) ? -1 : Math.Abs((x - y) / x))
    254           .Where(x => x > 0) // remove entries where the original value is 0
    255           .ToList();
     251        case "Absolute error": return originalValues.Zip(estimatedValues, (x, y) => Math.Abs(x - y))
     252            .Where(r => !double.IsNaN(r) && !double.IsInfinity(r)).ToList();
     253        case "Squared error": return originalValues.Zip(estimatedValues, (x, y) => (x - y) * (x - y))
     254            .Where(r => !double.IsNaN(r) && !double.IsInfinity(r)).ToList();
     255        case "Relative error":
     256          return originalValues.Zip(estimatedValues, (x, y) => x.IsAlmost(0.0) ? -1 : Math.Abs((x - y) / x))
     257            .Where(r => r > 0 && !double.IsNaN(r) && !double.IsInfinity(r)) // remove entries where the original value is 0
     258            .ToList();
    256259        default: throw new NotSupportedException();
    257260      }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartViewBase.cs

    r15584 r15811  
    2020#endregion
    2121using System;
    22 using System.Collections.Generic;
    2322using System.Drawing;
    2423using System.Linq;
     
    7271        this.chart.Series[TARGETVARIABLE_SERIES_NAME].LegendText = TARGETVARIABLE_SERIES_NAME;
    7372        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());
     73
     74        var rows = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray();
     75        var targetValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable);
     76
     77
     78        this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(rows.ToArray(), targetValues.Select(v => double.IsInfinity(v) ? double.NaN : v).ToArray());
    7679        // training series
    7780        this.chart.Series.Add(ESTIMATEDVALUES_TRAINING_SERIES_NAME);
     
    161164      var targetValues = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
    162165      double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min();
    163       double targetValuesRange = targetValues.Max() - targetValues.Min();
     166      double targetValuesRange = targetValues.Where(v => !double.IsInfinity(v) && !double.IsNaN(v)).Max() -
     167                                 targetValues.Where(v => !double.IsInfinity(v) && !double.IsNaN(v)).Min();
    164168      double interestingValuesRange = Math.Min(Math.Max(targetValuesRange, 1.0), Math.Max(estimatedValuesRange, 1.0));
    165169      double digits = (int)Math.Log10(interestingValuesRange) - 3;
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.cs

    r15584 r15811  
    126126
    127127      for (int i = 0; i < solution.ProblemData.Dataset.Rows; i++) {
     128        if (double.IsNaN(estimatedValues[i]) || double.IsInfinity(estimatedValues[i])) continue;
     129        if (double.IsNaN(targetValues[i]) || double.IsInfinity(targetValues[i])) continue;
    128130        double residual = estimatedValues[i] - targetValues[i];
    129131        residuals.Add(residual);
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs

    r15584 r15811  
    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]) && !double.IsNaN(target[i]) &&
     41            !double.IsInfinity(x[i]) && !double.IsNaN(x[i])) {
     42          x[i] = target[i] - x[i];
     43        } else {
     44          x[i] = 0.0;
     45        }
    4146      }
    4247    }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r15584 r15811  
    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
     169          .Concat(Content.EstimatedTestValues
     170          .Concat(Content.EstimatedValues
     171          .Concat(dataset.GetDoubleValues(targetVariableName))))
     172          .Where(v => !double.IsNaN(v) && !double.IsInfinity(v)).Max();
     173        double min = Content.EstimatedTrainingValues
     174          .Concat(Content.EstimatedTestValues
     175          .Concat(Content.EstimatedValues
     176          .Concat(dataset.GetDoubleValues(targetVariableName))))
     177          .Where(v => !double.IsNaN(v) && !double.IsInfinity(v)).Min();
    170178
    171179        double axisMin, axisMax, axisInterval;
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisResidualsLineChartView.cs

    r15584 r15811  
    2020#endregion
    2121
    22 using System;
    2322using System.Linq;
    24 using System.Windows.Forms.DataVisualization.Charting;
    2523using HeuristicLab.MainForm;
    2624
Note: See TracChangeset for help on using the changeset viewer.