Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/14/15 21:47:38 (8 years ago)
Author:
gkronber
Message:

#2452 refactored RegressionSolutionErrorCharacteristicsCurveView to better support comparison of a set of solutions in one chart (via drag&drop)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionErrorCharacteristicsCurveView.cs

    r12012 r13003  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    24 using System.Windows.Forms;
    2525using HeuristicLab.Algorithms.DataAnalysis;
    2626using HeuristicLab.MainForm;
     
    3131  [Content(typeof(ISymbolicRegressionSolution))]
    3232  public partial class SymbolicRegressionSolutionErrorCharacteristicsCurveView : RegressionSolutionErrorCharacteristicsCurveView {
    33     private IRegressionSolution linearRegressionSolution;
    3433    public SymbolicRegressionSolutionErrorCharacteristicsCurveView() {
    3534      InitializeComponent();
     
    4140    }
    4241
    43     protected override void OnContentChanged() {
    44       if (Content != null)
    45         linearRegressionSolution = CreateLinearRegressionSolution();
    46       else
    47         linearRegressionSolution = null;
    48 
    49       base.OnContentChanged();
    50     }
    51 
    52     protected override void UpdateChart() {
    53       base.UpdateChart();
    54       if (Content == null || linearRegressionSolution == null) return;
    55       AddRegressionSolution(linearRegressionSolution);
    56     }
    57 
    5842    private IRegressionSolution CreateLinearRegressionSolution() {
    5943      if (Content == null) throw new InvalidOperationException();
    6044      double rmse, cvRmsError;
    6145      var problemData = (IRegressionProblemData)ProblemData.Clone();
    62       if(!problemData.TrainingIndices.Any()) return null; // don't create an LR model if the problem does not have a training set (e.g. loaded into an existing model)
     46      if (!problemData.TrainingIndices.Any()) return null; // don't create an LR model if the problem does not have a training set (e.g. loaded into an existing model)
    6347
    6448      //clear checked inputVariables
     
    7761
    7862      var solution = LinearRegression.CreateLinearRegressionSolution(problemData, out rmse, out cvRmsError);
    79       solution.Name = "Linear Model";
     63      solution.Name = "Baseline (linear subset)";
    8064      return solution;
    8165    }
    8266
    83     protected override void Content_ModelChanged(object sender, EventArgs e) {
    84       linearRegressionSolution = CreateLinearRegressionSolution();
    85       base.Content_ModelChanged(sender, e);
    86     }
    8767
    88     protected override void Content_ProblemDataChanged(object sender, EventArgs e) {
    89       linearRegressionSolution = CreateLinearRegressionSolution();
    90       base.Content_ProblemDataChanged(sender, e);
     68    protected override IEnumerable<IRegressionSolution> CreateBaselineSolutions() {
     69      foreach (var sol in base.CreateBaselineSolutions()) yield return sol;
     70      yield return CreateLinearRegressionSolution();
    9171    }
    9272  }
Note: See TracChangeset for help on using the changeset viewer.