- Timestamp:
- 05/05/17 20:06:42 (8 years ago)
- Location:
- stable
- Files:
-
- 2 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14483,14486
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged: 14483,14486
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs
r14483 r14940 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Views { 29 [View(" Line Chart (residuals)")]29 [View("Residuals Line Chart")] 30 30 [Content(typeof(IRegressionSolution))] 31 public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartView , IDataAnalysisSolutionEvaluationView {31 public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartViewBase, IDataAnalysisSolutionEvaluationView { 32 32 33 33 … … 37 37 } 38 38 39 protected override void GetTrainingSeries(out int[] x, out double[] y) { 40 base.GetTrainingSeries(out x, out y); 39 protected override void GetTrainingSeries(out int[] idx, out double[] y) { 40 idx = Content.ProblemData.TrainingIndices.ToArray(); 41 y = Content.EstimatedTrainingValues.ToArray(); 42 CalcResiduals(idx, y); 43 } 44 45 private void CalcResiduals(int[] idx, double[] x) { 41 46 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];47 var target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, idx).ToArray(); 48 for (int i = 0; i < idx.Length; i++) { 49 x[i] -= target[i]; 45 50 } 46 51 } 47 52 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 } 53 protected override void GetTestSeries(out int[] idx, out double[] y) { 54 idx = Content.ProblemData.TestIndices.ToArray(); 55 y = Content.EstimatedTestValues.ToArray(); 56 CalcResiduals(idx, y); 55 57 } 56 58 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 } 59 protected override void GetAllValuesSeries(out int[] idx, out double[] y) { 60 idx = Content.ProblemData.AllIndices.ToArray(); 61 y = Content.EstimatedValues.ToArray(); 62 CalcResiduals(idx, y); 64 63 } 65 64 … … 70 69 71 70 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; 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); 80 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); 85 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 91 } 76 92
Note: See TracChangeset
for help on using the changeset viewer.