source: stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/ConfidenceRegressionSolutionEstimatedValuesView.cs @ 14186

Last change on this file since 14186 was 14186, checked in by swagner, 3 years ago

#2526: Updated year of copyrights in license headers

File size: 3.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21using System.Linq;
22using System.Windows.Forms;
23using HeuristicLab.Data;
24using HeuristicLab.MainForm;
25using HeuristicLab.Problems.DataAnalysis;
26using HeuristicLab.Problems.DataAnalysis.Views;
27
28namespace HeuristicLab.Algorithms.DataAnalysis.Views {
29  [View("Estimated Values")]
30  [Content(typeof(IConfidenceRegressionSolution), false)]
31  public partial class ConfidenceRegressionSolutionEstimatedValuesView : RegressionSolutionEstimatedValuesView {
32    private const string ESTIMATEDVARIANCES_SERIES_NAME = "Estimated Variances (all)";
33    private const string ESTIMATEDVARIANCES_TRAINING_SERIES_NAME = "Estimated Variances (training)";
34    private const string ESTIMATEDVARIANCES_TEST_SERIES_NAME = "Estimated Variances (test)";
35
36    public new IConfidenceRegressionSolution Content {
37      get { return (IConfidenceRegressionSolution)base.Content; }
38      set { base.Content = value; }
39    }
40
41    public ConfidenceRegressionSolutionEstimatedValuesView()
42      : base() {
43      InitializeComponent();
44    }
45
46
47    protected override StringMatrix CreateValueMatrix() {
48      var matrix = base.CreateValueMatrix();
49
50      var columnNames = matrix.ColumnNames.Concat(new[] { ESTIMATEDVARIANCES_SERIES_NAME, ESTIMATEDVARIANCES_TRAINING_SERIES_NAME, ESTIMATEDVARIANCES_TEST_SERIES_NAME }).ToList();
51      ((IStringConvertibleMatrix)matrix).Columns += 3;
52      matrix.ColumnNames = columnNames;
53
54      var trainingRows = Content.ProblemData.TrainingIndices;
55      var testRows = Content.ProblemData.TestIndices;
56
57      var estimated_var = Content.EstimatedVariances.GetEnumerator();
58      var estimated_var_training = Content.GetEstimatedVariances(trainingRows).GetEnumerator();
59      var estimated_var_test = Content.GetEstimatedVariances(testRows).GetEnumerator();
60
61      foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) {
62        estimated_var.MoveNext();
63        matrix[row, 7] = estimated_var.Current.ToString();
64      }
65
66      foreach (var row in Content.ProblemData.TrainingIndices) {
67        estimated_var_training.MoveNext();
68        matrix[row, 8] = estimated_var_training.Current.ToString();
69      }
70
71      foreach (var row in Content.ProblemData.TestIndices) {
72        estimated_var_test.MoveNext();
73        matrix[row, 9] = estimated_var_test.Current.ToString();
74      }
75
76
77      return matrix;
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.