Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/20/12 17:24:14 (12 years ago)
Author:
sforsten
Message:

#1776: merged r7864:8507 trunk into branch

Location:
branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views

  • branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs

    r7406 r8508  
    7272        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    7373        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color;
    74         this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray());
     74        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), Content.EstimatedTrainingValues.ToArray());
    7575        this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]);
    7676        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content;
     
    7979        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME;
    8080        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    81         this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray());
     81        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndices.ToArray(), Content.EstimatedTestValues.ToArray());
    8282        this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]);
    8383        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content;
    8484        // series of remaining points
    85         int[] allIndizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray();
     85        int[] allIndices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray();
    8686        var estimatedValues = Content.EstimatedValues.ToArray();
    87         List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList();
     87        List<double> allEstimatedValues = allIndices.Select(index => estimatedValues[index]).ToList();
    8888        this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME);
    8989        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME;
    9090        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    91         this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndizes, allEstimatedValues);
    92         this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     91        if (allEstimatedValues.Count > 0) {
     92          this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues);
     93          this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     94        }
    9395        this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content;
    9496        this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]);
     
    170172
    171173      int[] attr = new int[Content.ProblemData.Dataset.Rows + 1]; // add a virtual last row that is again empty to simplify loop further down
    172       foreach (var row in Content.ProblemData.TrainingIndizes) {
     174      foreach (var row in Content.ProblemData.TrainingIndices) {
    173175        attr[row] += 1;
    174176      }
    175       foreach (var row in Content.ProblemData.TestIndizes) {
     177      foreach (var row in Content.ProblemData.TestIndices) {
    176178        attr[row] += 2;
    177179      }
     
    223225        string targetVariableName = Content.ProblemData.TargetVariable;
    224226
    225         IEnumerable<int> indizes = null;
    226         IEnumerable<double> predictedValues = null;
     227        IEnumerable<int> indices = null;
     228        double[] predictedValues = null;
    227229        switch (series.Name) {
    228230          case ESTIMATEDVALUES_ALL_SERIES_NAME:
    229             indizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray();
     231            indices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray();
    230232            var estimatedValues = Content.EstimatedValues.ToArray();
    231             predictedValues = indizes.Select(index => estimatedValues[index]).ToList();
     233            predictedValues = indices.Select(index => estimatedValues[index]).ToArray();
    232234            break;
    233235          case ESTIMATEDVALUES_TRAINING_SERIES_NAME:
    234             indizes = Content.ProblemData.TrainingIndizes.ToArray();
     236            indices = Content.ProblemData.TrainingIndices.ToArray();
    235237            predictedValues = Content.EstimatedTrainingValues.ToArray();
    236238            break;
    237239          case ESTIMATEDVALUES_TEST_SERIES_NAME:
    238             indizes = Content.ProblemData.TestIndizes.ToArray();
     240            indices = Content.ProblemData.TestIndices.ToArray();
    239241            predictedValues = Content.EstimatedTestValues.ToArray();
    240242            break;
    241243        }
    242         series.Points.DataBindXY(indizes, predictedValues);
    243         this.InsertEmptyPoints(series);
     244        if (predictedValues.Length > 0) {
     245          series.Points.DataBindXY(indices, predictedValues);
     246          this.InsertEmptyPoints(series);
     247        }
    244248        chart.Legends[series.Legend].ForeColor = Color.Black;
    245249        UpdateCursorInterval();
Note: See TracChangeset for help on using the changeset viewer.