Changeset 14942 for stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs
- Timestamp:
- 05/05/17 20:08:49 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14531-14532,14937
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged: 14531-14532,14937
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs
r14940 r14942 25 25 using HeuristicLab.MainForm; 26 26 27 28 27 namespace HeuristicLab.Problems.DataAnalysis.Views { 29 28 [View("Residuals Line Chart")] … … 31 30 public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartViewBase, IDataAnalysisSolutionEvaluationView { 32 31 32 public RegressionSolutionResidualsLineChartView() : base() { 33 InitializeComponent(); 34 } 33 35 34 public RegressionSolutionResidualsLineChartView() 35 : base() { 36 InitializeComponent(); 36 protected void CalcResiduals(int[] idx, double[] x) { 37 var problemData = Content.ProblemData; 38 var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, idx).ToArray(); 39 for (int i = 0; i < idx.Length; i++) { 40 x[i] = target[i] - x[i]; 41 } 37 42 } 38 43 … … 41 46 y = Content.EstimatedTrainingValues.ToArray(); 42 47 CalcResiduals(idx, y); 43 }44 45 private void CalcResiduals(int[] idx, double[] x) {46 var problemData = Content.ProblemData;47 var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, idx).ToArray();48 for (int i = 0; i < idx.Length; i++) {49 x[i] -= target[i];50 }51 48 } 52 49 … … 69 66 70 67 private void UpdateSeriesStyle() { 71 if (InvokeRequired) Invoke((Action)UpdateSeriesStyle); 72 else { 73 if (Content == null) return; 74 double[] res; 75 int[] idx; 76 GetTrainingSeries(out idx, out res); 77 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TRAINING_SERIES_NAME].YAxisType = AxisType.Secondary; 78 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.RangeColumn; 79 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(idx, res.Select(_ => 0.0).ToArray(), res); 68 if (Content == null) return; 80 69 81 GetTestSeries(out idx, out res);82 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TEST_SERIES_NAME].YAxisType = AxisType.Secondary;83 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.RangeColumn;84 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(idx, res.Select(_ => 0.0).ToArray(), res);70 if (InvokeRequired) { 71 Invoke((Action)UpdateSeriesStyle); 72 return; 73 } 85 74 86 GetAllValuesSeries(out idx, out res); 87 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_ALL_SERIES_NAME].YAxisType = AxisType.Secondary; 88 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.RangeColumn; 89 base.chart.Series[RegressionSolutionLineChartView.ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(idx, res.Select(_ => 0.0).ToArray(), res); 90 } 75 double[] res; 76 int[] idx; 77 GetTrainingSeries(out idx, out res); 78 chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].YAxisType = AxisType.Secondary; 79 chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.RangeColumn; 80 chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(idx, res.Select(_ => 0.0).ToArray(), res); 81 82 GetTestSeries(out idx, out res); 83 chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].YAxisType = AxisType.Secondary; 84 chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.RangeColumn; 85 chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(idx, res.Select(_ => 0.0).ToArray(), res); 86 87 GetAllValuesSeries(out idx, out res); 88 chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].YAxisType = AxisType.Secondary; 89 chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.RangeColumn; 90 chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(idx, res.Select(_ => 0.0).ToArray(), res); 91 ToggleSeriesData(chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); // don't show by default 91 92 } 92 93
Note: See TracChangeset
for help on using the changeset viewer.