Free cookie consent management tool by TermsFeed Policy Generator

source: branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessRegressionSolutionEstimatedValuesView.cs @ 14648

Last change on this file since 14648 was 14029, checked in by gkronber, 8 years ago

#2434: merged trunk changes r12934:14026 from trunk to branch

File size: 2.8 KB
RevLine 
[13439]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 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.Views;
26
27namespace HeuristicLab.Algorithms.DataAnalysis.Views {
28  [View("Estimated Values")]
29  [Content(typeof(GaussianProcessRegressionSolution), false)]
30  public partial class GaussianProcessRegressionSolutionEstimatedValuesView : RegressionSolutionEstimatedValuesView {
31    private const string ESTIMATEDVARIANCE_TRAINING_SERIES_NAME = "Estimated Variance (training)";
32    private const string ESTIMATEDVARIANCE_TEST_SERIES_NAME = "Estimated Variance (test)";
33
34    public new GaussianProcessRegressionSolution Content {
35      get { return (GaussianProcessRegressionSolution)base.Content; }
[13592]36      set { base.Content = value; }
[13439]37    }
38
39    public GaussianProcessRegressionSolutionEstimatedValuesView()
40      : base() {
41      InitializeComponent();
42    }
43
44
[13592]45    protected override StringMatrix CreateValueMatrix() {
46      var matrix = base.CreateValueMatrix();
[13439]47
[13592]48      var columnNames = matrix.ColumnNames.Concat(new[] { ESTIMATEDVARIANCE_TRAINING_SERIES_NAME, ESTIMATEDVARIANCE_TEST_SERIES_NAME }).ToList();
49      ((IStringConvertibleMatrix)matrix).Columns += 2;
50      matrix.ColumnNames = columnNames;
[13439]51
[13592]52      var trainingRows = Content.ProblemData.TrainingIndices;
53      var testRows = Content.ProblemData.TestIndices;
[13439]54
[13592]55      var estimated_var_training = Content.GetEstimatedVariance(trainingRows).GetEnumerator();
56      var estimated_var_test = Content.GetEstimatedVariance(testRows).GetEnumerator();
[13439]57
[13592]58      foreach (var row in Content.ProblemData.TrainingIndices) {
59        estimated_var_training.MoveNext();
60        matrix[row, 7] = estimated_var_training.Current.ToString();
61      }
[13439]62
[13592]63      foreach (var row in Content.ProblemData.TestIndices) {
64        estimated_var_test.MoveNext();
65        matrix[row, 8] = estimated_var_test.Current.ToString();
66      }
[13439]67
68
[13592]69      return matrix;
[13439]70    }
71  }
72}
Note: See TracBrowser for help on using the repository browser.