Changeset 7043


Ignore:
Timestamp:
11/22/11 16:21:11 (11 years ago)
Author:
mkommend
Message:

#1612: Created mean model for RegressionSolutionErrorCharacteristicsCurveView.

Location:
trunk/sources
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs

    r6642 r7043  
    4949      this.chart.TabIndex = 0;
    5050      this.chart.Text = "chart";
     51      this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);
    5152      //
    5253      // label1
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r6982 r7043  
    3131  [Content(typeof(IRegressionSolution))]
    3232  public partial class RegressionSolutionErrorCharacteristicsCurveView : DataAnalysisSolutionEvaluationView {
     33    private IRegressionSolution constantModel;
    3334    protected const string TrainingSamples = "Training";
    3435    protected const string TestSamples = "Test";
     
    101102      if (Content == null) return;
    102103
    103       var originalValues = GetOriginalValues();
    104       var meanModelEstimatedValues = GetMeanModelEstimatedValues(originalValues);
     104      var originalValues = GetOriginalValues().ToList();
     105      constantModel = CreateConstantModel();
     106      var meanModelEstimatedValues = GetEstimatedValues(constantModel);
    105107      var meanModelResiduals = GetResiduals(originalValues, meanModelEstimatedValues);
    106108
     
    113115      UpdateSeries(meanModelResiduals, meanModelSeries);
    114116      meanModelSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(meanModelSeries);
     117      meanModelSeries.Tag = constantModel;
    115118      chart.Series.Add(meanModelSeries);
    116119
     
    225228      else UpdateChart();
    226229    }
     230
     231    #region Mean Model
     232    private void chart_MouseDown(object sender, MouseEventArgs e) {
     233      if (e.Clicks < 2) return;
     234      HitTestResult result = chart.HitTest(e.X, e.Y);
     235      if (result.ChartElementType != ChartElementType.LegendItem) return;
     236      if (result.Series.Name != constantModel.Name) return;
     237
     238      MainFormManager.MainForm.ShowContent((IRegressionSolution)result.Series.Tag);
     239    }
     240
     241    private IRegressionSolution CreateConstantModel() {
     242      double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average();
     243      var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData);
     244      solution.Name = "Mean Model";
     245      return solution;
     246    }
     247    #endregion
    227248  }
    228249}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r6974 r7043  
    122122    <Compile Include="Implementation\Clustering\ClusteringProblemData.cs" />
    123123    <Compile Include="Implementation\Clustering\ClusteringSolution.cs" />
     124    <Compile Include="Implementation\Regression\ConstantRegressionModel.cs" />
     125    <Compile Include="Implementation\Regression\ConstantRegressionSolution.cs" />
    124126    <Compile Include="Implementation\Regression\RegressionEnsembleProblemData.cs" />
    125127    <Compile Include="Implementation\Regression\RegressionEnsembleModel.cs">
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs

    r6672 r7043  
    4343
    4444    private static readonly ClassificationEnsembleProblemData emptyProblemData;
    45     public static ClassificationEnsembleProblemData EmptyProblemData {
     45    public static new ClassificationEnsembleProblemData EmptyProblemData {
    4646      get { return emptyProblemData; }
    4747    }
Note: See TracChangeset for help on using the changeset viewer.