Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14940


Ignore:
Timestamp:
05/05/17 20:06:42 (8 years ago)
Author:
gkronber
Message:

#2718: merged r14483 and r14486 from trunk to stable

Location:
stable
Files:
4 edited
6 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

    r14939 r14940  
    246246    <Compile Include="Regression\RegressionFeatureCorrelationView.Designer.cs">
    247247      <DependentUpon>RegressionFeatureCorrelationView.cs</DependentUpon>
     248    </Compile>
     249    <Compile Include="Regression\RegressionSolutionLineChartViewBase.cs">
     250      <SubType>UserControl</SubType>
     251    </Compile>
     252    <Compile Include="Regression\RegressionSolutionLineChartViewBase.Designer.cs">
     253      <DependentUpon>RegressionSolutionLineChartViewBase.cs</DependentUpon>
     254    </Compile>
     255    <Compile Include="Regression\RegressionSolutionResidualsLineChartView.cs">
     256      <SubType>UserControl</SubType>
     257    </Compile>
     258    <Compile Include="Regression\RegressionSolutionResidualsLineChartView.Designer.cs">
     259      <DependentUpon>RegressionSolutionResidualsLineChartView.cs</DependentUpon>
    248260    </Compile>
    249261    <Compile Include="Regression\RegressionSolutionVariableImpactsView.cs">
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualsLineChartView.cs

    r14483 r14940  
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Views {
    29   [View("Line Chart (residuals)")]
     29  [View("Residuals Line Chart")]
    3030  [Content(typeof(IRegressionSolution))]
    31   public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartView, IDataAnalysisSolutionEvaluationView {
     31  public partial class RegressionSolutionResidualsLineChartView : RegressionSolutionLineChartViewBase, IDataAnalysisSolutionEvaluationView {
    3232
    3333
     
    3737    }
    3838
    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) {
    4146      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];
    4550      }
    4651    }
    4752
    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);
    5557    }
    5658
    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);
    6463    }
    6564
     
    7069
    7170    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      }
    7591    }
    7692
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisLineChartView.cs

    r14939 r14940  
    4040    }
    4141
    42     protected override void GetTestSeries(out int[] x, out double[] y) {
     42    protected override void GetTrainingSeries(out int[] idx, out double[] y) {
     43      idx = Content.ProblemData.TrainingIndices.ToArray();
     44      y = Content.EstimatedTrainingValues.ToArray();
     45    }
     46
     47    protected override void GetTestSeries(out int[] idx, out double[] y) {
    4348      // treat the whole test partition as prognosis horizon
    44       x = Content.ProblemData.TestIndices.ToArray();
     49      idx = Content.ProblemData.TestIndices.ToArray();
    4550      y = Content.PrognosedTestValues.ToArray();
    4651    }
    4752
    48     protected override void GetAllValuesSeries(out int[] x, out double[] y) {
     53    protected override void GetAllValuesSeries(out int[] idx, out double[] y) {
    4954      // not supported
    50       x = new int[0];
     55      idx = new int[0];
    5156      y = new double[0];
    5257    }
Note: See TracChangeset for help on using the changeset viewer.