[5678] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[7268] | 3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[5678] | 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
|
---|
| 21 | using System;
|
---|
| 22 | using System.Linq;
|
---|
| 23 | using System.Windows.Forms;
|
---|
| 24 | using HeuristicLab.Data;
|
---|
| 25 | using HeuristicLab.MainForm;
|
---|
| 26 | using HeuristicLab.MainForm.WindowsForms;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Problems.DataAnalysis.Views {
|
---|
[5975] | 29 | [View("Estimated Class Values")]
|
---|
[5678] | 30 | [Content(typeof(IDiscriminantFunctionClassificationSolution))]
|
---|
[6642] | 31 | public partial class DiscriminantFunctionClassificationSolutionEstimatedClassValuesView : ClassificationSolutionEstimatedClassValuesView {
|
---|
[5678] | 32 | private const string TargetClassValuesSeriesname = "TargetVariable";
|
---|
| 33 | private const string EstimatedClassValuesSeriesName = "EstimatedClassValues";
|
---|
| 34 | private const string EstimatedValuesSeriesName = "EstimatedValues";
|
---|
| 35 |
|
---|
| 36 | public new IDiscriminantFunctionClassificationSolution Content {
|
---|
| 37 | get { return (IDiscriminantFunctionClassificationSolution)base.Content; }
|
---|
[6642] | 38 | set { base.Content = value; }
|
---|
[5678] | 39 | }
|
---|
| 40 |
|
---|
| 41 | public DiscriminantFunctionClassificationSolutionEstimatedClassValuesView()
|
---|
| 42 | : base() {
|
---|
| 43 | InitializeComponent();
|
---|
| 44 | }
|
---|
| 45 |
|
---|
[6642] | 46 | protected override void UpdateEstimatedValues() {
|
---|
[5678] | 47 | if (InvokeRequired) Invoke((Action)UpdateEstimatedValues);
|
---|
| 48 | else {
|
---|
[6255] | 49 | StringMatrix matrix = null;
|
---|
[5678] | 50 | if (Content != null) {
|
---|
[6411] | 51 | string[,] values = new string[Content.ProblemData.Dataset.Rows, 4];
|
---|
[5678] | 52 |
|
---|
[6740] | 53 | double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray();
|
---|
[5678] | 54 | double[] estimatedClassValues = Content.EstimatedClassValues.ToArray();
|
---|
| 55 | double[] estimatedValues = Content.EstimatedValues.ToArray();
|
---|
| 56 | for (int row = 0; row < target.Length; row++) {
|
---|
[6255] | 57 | values[row, 0] = row.ToString();
|
---|
| 58 | values[row, 1] = target[row].ToString();
|
---|
| 59 | values[row, 2] = estimatedClassValues[row].ToString();
|
---|
| 60 | values[row, 3] = estimatedValues[row].ToString();
|
---|
[5678] | 61 | }
|
---|
| 62 |
|
---|
[6255] | 63 | matrix = new StringMatrix(values);
|
---|
| 64 | matrix.ColumnNames = new string[] { "Id", TargetClassValuesSeriesname, EstimatedClassValuesSeriesName, EstimatedValuesSeriesName };
|
---|
| 65 | matrix.SortableView = true;
|
---|
[5678] | 66 | }
|
---|
| 67 | matrixView.Content = matrix;
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 | }
|
---|