Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/14 19:36:38 (10 years ago)
Author:
mkommend
Message:

#2197: Merged r11093 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Views

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

    r10527 r11149  
    9999      chart.Series.Clear();
    100100      chart.Annotations.Clear();
     101
    101102      if (Content == null) return;
    102 
    103       var constantModel = CreateConstantModel();
    104       var originalValues = GetOriginalValues().ToList();
    105       var baselineEstimatedValues = GetEstimatedValues(constantModel);
    106       var baselineResiduals = GetResiduals(originalValues, baselineEstimatedValues);
    107 
    108       baselineResiduals.Sort();
    109       chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling(baselineResiduals.Last());
    110       chart.ChartAreas[0].CursorX.Interval = baselineResiduals.First() / 100;
    111 
    112       Series baselineSeries = new Series("Baseline");
    113       baselineSeries.ChartType = SeriesChartType.FastLine;
    114       UpdateSeries(baselineResiduals, baselineSeries);
    115       baselineSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(baselineSeries);
    116       baselineSeries.Tag = constantModel;
    117       baselineSeries.LegendToolTip = "Double-click to open model";
    118       chart.Series.Add(baselineSeries);
     103      if (cmbSamples.SelectedItem.ToString() == TrainingSamples && !ProblemData.TrainingIndices.Any()) return;
     104      if (cmbSamples.SelectedItem.ToString() == TestSamples && !ProblemData.TestIndices.Any()) return;
     105
     106      if (Content.ProblemData.TrainingIndices.Any()) {
     107        var constantModel = CreateConstantModel();
     108        var originalValues = GetOriginalValues().ToList();
     109        var baselineEstimatedValues = GetEstimatedValues(constantModel);
     110        var baselineResiduals = GetResiduals(originalValues, baselineEstimatedValues);
     111
     112        Series baselineSeries = new Series("Baseline");
     113        baselineSeries.ChartType = SeriesChartType.FastLine;
     114        UpdateSeries(baselineResiduals, baselineSeries);
     115        baselineSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(baselineSeries);
     116        baselineSeries.Tag = constantModel;
     117        baselineSeries.LegendToolTip = "Double-click to open model";
     118        chart.Series.Add(baselineSeries);
     119      }
    119120
    120121      AddRegressionSolution(Content);
     
    127128      solutionSeries.Tag = solution;
    128129      solutionSeries.ChartType = SeriesChartType.FastLine;
    129       var estimatedValues = GetResiduals(GetOriginalValues(), GetEstimatedValues(solution));
    130       UpdateSeries(estimatedValues, solutionSeries);
     130      var residuals = GetResiduals(GetOriginalValues(), GetEstimatedValues(solution));
     131     
     132      chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling(residuals.Max());
     133      chart.ChartAreas[0].CursorX.Interval = residuals.Min() / 100;
     134
     135      UpdateSeries(residuals, solutionSeries);
     136
    131137      solutionSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(solutionSeries);
    132138      solutionSeries.LegendToolTip = "Double-click to open model";
     
    236242      double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average();
    237243      var model = new ConstantRegressionModel(averageTrainingTarget);
    238       var solution = new ConstantRegressionSolution(model,(IRegressionProblemData)ProblemData.Clone());
     244      var solution = new ConstantRegressionSolution(model, (IRegressionProblemData)ProblemData.Clone());
    239245      solution.Name = "Baseline";
    240246      return solution;
Note: See TracChangeset for help on using the changeset viewer.