Changeset 14942


Ignore:
Timestamp:
05/05/17 20:08:49 (2 years ago)
Author:
gkronber
Message:

#2718: merged r14531,r14532,r14940 from trunk to stable

Location:
stable
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r14940 r14942  
    422422    <Compile Include="Solution Views\TimeSeriesPrognosisSolutionView.Designer.cs">
    423423      <DependentUpon>TimeSeriesPrognosisSolutionView.cs</DependentUpon>
     424    </Compile>
     425    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisResidualsLineChartView.cs">
     426      <SubType>UserControl</SubType>
     427    </Compile>
     428    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisResidualsLineChartView.Designer.cs">
     429      <DependentUpon>TimeSeriesPrognosisResidualsLineChartView.cs</DependentUpon>
    424430    </Compile>
    425431    <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisLineChartView.cs">
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartViewBase.cs

    r14940 r14942  
    253253    }
    254254
    255     private void ToggleSeriesData(Series series) {
     255    public void ToggleSeriesData(Series series) {
    256256      if (series.Points.Count > 0) {  //checks if series is shown
    257257        if (this.chart.Series.Any(s => s != series && s.Points.Count > 0)) {
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs

    r14940 r14942  
    2525using HeuristicLab.MainForm;
    2626
    27 
    2827namespace HeuristicLab.Problems.DataAnalysis.Views {
    2928  [View("Residuals Line Chart")]
     
    3130  public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartViewBase, IDataAnalysisSolutionEvaluationView {
    3231
     32    public RegressionSolutionResidualsLineChartView() : base() {
     33      InitializeComponent();
     34    }
    3335
    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      }
    3742    }
    3843
     
    4146      y = Content.EstimatedTrainingValues.ToArray();
    4247      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       }
    5148    }
    5249
     
    6966
    7067    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;
    8069
    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      }
    8574
    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
    9192    }
    9293
Note: See TracChangeset for help on using the changeset viewer.