Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/ConfidenceRegressionSolutionEstimatedValuesView.cs @ 14267

Last change on this file since 14267 was 14185, checked in by swagner, 8 years ago

#2526: Updated year of copyrights in license headers

File size: 3.2 KB
RevLine 
[13439]1#region License Information
2/* HeuristicLab
[14185]3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[13439]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;
[13856]25using HeuristicLab.Problems.DataAnalysis;
[13439]26using HeuristicLab.Problems.DataAnalysis.Views;
27
28namespace HeuristicLab.Algorithms.DataAnalysis.Views {
29  [View("Estimated Values")]
[14099]30  [Content(typeof(IConfidenceRegressionSolution), false)]
31  public partial class ConfidenceRegressionSolutionEstimatedValuesView : RegressionSolutionEstimatedValuesView {
[13856]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)";
[13439]35
[14099]36    public new IConfidenceRegressionSolution Content {
37      get { return (IConfidenceRegressionSolution)base.Content; }
[13592]38      set { base.Content = value; }
[13439]39    }
40
[14099]41    public ConfidenceRegressionSolutionEstimatedValuesView()
[13439]42      : base() {
43      InitializeComponent();
44    }
45
46
[13592]47    protected override StringMatrix CreateValueMatrix() {
48      var matrix = base.CreateValueMatrix();
[13439]49
[13856]50      var columnNames = matrix.ColumnNames.Concat(new[] { ESTIMATEDVARIANCES_SERIES_NAME, ESTIMATEDVARIANCES_TRAINING_SERIES_NAME, ESTIMATEDVARIANCES_TEST_SERIES_NAME }).ToList();
51      ((IStringConvertibleMatrix)matrix).Columns += 3;
[13592]52      matrix.ColumnNames = columnNames;
[13439]53
[13592]54      var trainingRows = Content.ProblemData.TrainingIndices;
55      var testRows = Content.ProblemData.TestIndices;
[13439]56
[13856]57      var estimated_var = Content.EstimatedVariances.GetEnumerator();
[13823]58      var estimated_var_training = Content.GetEstimatedVariances(trainingRows).GetEnumerator();
59      var estimated_var_test = Content.GetEstimatedVariances(testRows).GetEnumerator();
[13439]60
[13856]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
[13592]66      foreach (var row in Content.ProblemData.TrainingIndices) {
67        estimated_var_training.MoveNext();
[13856]68        matrix[row, 8] = estimated_var_training.Current.ToString();
[13592]69      }
[13439]70
[13592]71      foreach (var row in Content.ProblemData.TestIndices) {
72        estimated_var_test.MoveNext();
[13856]73        matrix[row, 9] = estimated_var_test.Current.ToString();
[13592]74      }
[13439]75
76
[13592]77      return matrix;
[13439]78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.