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
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Linq;
|
---|
24 | using System.Windows.Forms.DataVisualization.Charting;
|
---|
25 | using HeuristicLab.MainForm;
|
---|
26 |
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Problems.DataAnalysis.Views {
|
---|
29 | [View("Line Chart (residuals)")]
|
---|
30 | [Content(typeof(IRegressionSolution))]
|
---|
31 | public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartView, IDataAnalysisSolutionEvaluationView {
|
---|
32 |
|
---|
33 |
|
---|
34 | public RegressionSolutionResidualsLineChartView()
|
---|
35 | : base() {
|
---|
36 | InitializeComponent();
|
---|
37 | }
|
---|
38 |
|
---|
39 | protected override void GetTrainingSeries(out int[] x, out double[] y) {
|
---|
40 | base.GetTrainingSeries(out x, out y);
|
---|
41 | var problemData = Content.ProblemData;
|
---|
42 | var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, x).ToArray();
|
---|
43 | for (int i = 0; i < x.Length; i++) {
|
---|
44 | y[i] -= target[i];
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | protected override void GetTestSeries(out int[] x, out double[] y) {
|
---|
49 | base.GetTestSeries(out x, out y);
|
---|
50 | var problemData = Content.ProblemData;
|
---|
51 | var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, x).ToArray();
|
---|
52 | for (int i = 0; i < x.Length; i++) {
|
---|
53 | y[i] -= target[i];
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | protected override void GetAllValuesSeries(out int[] x, out double[] y) {
|
---|
58 | base.GetAllValuesSeries(out x, out y);
|
---|
59 | var problemData = Content.ProblemData;
|
---|
60 | var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, x).ToArray();
|
---|
61 | for (int i = 0; i < x.Length; i++) {
|
---|
62 | y[i] -= target[i];
|
---|
63 | }
|
---|
64 | }
|
---|
65 |
|
---|
66 | protected override void RedrawChart() {
|
---|
67 | base.RedrawChart();
|
---|
68 | UpdateSeriesStyle();
|
---|
69 | }
|
---|
70 |
|
---|
71 | private void UpdateSeriesStyle() {
|
---|
72 | base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TRAINING_SERIES_NAME].YAxisType = AxisType.Secondary;
|
---|
73 | base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TEST_SERIES_NAME].YAxisType = AxisType.Secondary;
|
---|
74 | base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_ALL_SERIES_NAME].YAxisType = AxisType.Secondary;
|
---|
75 | }
|
---|
76 |
|
---|
77 | }
|
---|
78 | }
|
---|