Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6982


Ignore:
Timestamp:
11/10/11 13:04:09 (13 years ago)
Author:
mkommend
Message:

#1675: Corrected emtpy solution ensembles and adapted views to handle empty ensembles correctly.

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs

    r6740 r6982  
    106106        values[i, 0] = row.ToString();
    107107        values[i, 1] = target[i].ToString();
     108        //display only indices and target values if no models are present
     109        if (i >= estimatedClassValues.Length) continue;
     110
    108111        values[i, 2] = estimatedClassValues[i].ToString();
    109112        values[i, 3] = (target[i] == estimatedClassValues[i]).ToString();
     
    131134      matrix.SortableView = true;
    132135      matrixView.Content = matrix;
    133       UpdateColoringOfRows();
    134136    }
    135137
     
    162164        return;
    163165      }
    164       bool correctClassified = bool.Parse(matrixView.DataGridView[3, e.RowIndex].Value.ToString());
     166      var cellValue = matrixView.DataGridView[3, e.RowIndex].Value.ToString();
     167      if (string.IsNullOrEmpty(cellValue)) return;
     168      bool correctClassified = bool.Parse(cellValue);
    165169      matrixView.DataGridView.Rows[e.RowIndex].DefaultCellStyle.ForeColor = correctClassified ? Color.MediumSeaGreen : Color.Red;
    166     }
    167 
    168     private void UpdateColoringOfRows() {
    169       if (InvokeRequired) {
    170         Invoke((Action)UpdateColoringOfRows);
    171         return;
    172       }
    173       //matrixView.DataGridView.SuspendRepaint();
    174       //for (int i = 0; i < matrixView.DataGridView.Rows.Count; i++) {
    175       //  bool correctClassified = bool.Parse(matrixView.Content.GetValue(i, 3));
    176       //  matrixView.DataGridView.Rows[i].DefaultCellStyle.ForeColor = correctClassified ? Color.MediumSeaGreen : Color.Red;
    177       //}
    178       //matrixView.DataGridView.ResumeRepaint(true);
    179170    }
    180171  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r6750 r6982  
    133133      series.Points.Clear();
    134134      residuals.Sort();
     135      if (!residuals.Any() || residuals.All(double.IsNaN)) return;
    135136
    136137      series.Points.AddXY(0, 0);
     
    146147
    147148        point.XValue = residuals[i];
    148         point.YValues[0] = ((double)i+1) / residuals.Count;
     149        point.YValues[0] = ((double)i + 1) / residuals.Count;
    149150        point.ToolTip = "Error: " + point.XValue + "\n" + "Samples: " + point.YValues[0];
    150151        series.Points.Add(point);
     
    206207
    207208    private double CalculateAreaOverCurve(Series series) {
    208       if (series.Points.Count < 1) throw new ArgumentException("Could not calculate area under curve if less than 1 data points were given.");
     209      if (series.Points.Count < 1) return 0;
    209210
    210211      double auc = 0.0;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r6740 r6982  
    2020#endregion
    2121using System;
    22 using System.Collections.Generic;
    2322using System.Drawing;
    2423using System.Linq;
     
    172171        string targetVariableName = Content.ProblemData.TargetVariable;
    173172
    174         IEnumerable<double> predictedValues = null;
    175         IEnumerable<double> targetValues = null;
     173        double[] predictedValues = null;
     174        double[] targetValues = null;
    176175        switch (series.Name) {
    177176          case ALL_SERIES:
     
    188187            break;
    189188        }
    190         series.Points.DataBindXY(predictedValues, "", targetValues, "");
     189        if (predictedValues.Length == targetValues.Length)
     190          series.Points.DataBindXY(predictedValues, "", targetValues, "");
    191191        this.chart.Legends[series.Legend].ForeColor = Color.Black;
    192192        UpdateCursorInterval();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs

    r6666 r6982  
    201201
    202202    public IEnumerable<IEnumerable<double>> GetEstimatedClassValueVectors(Dataset dataset, IEnumerable<int> rows) {
     203      if (!Model.Models.Any()) yield break;
    203204      var estimatedValuesEnumerators = (from model in Model.Models
    204205                                        select model.GetEstimatedClassValues(dataset, rows).GetEnumerator())
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs

    r6666 r6982  
    6464    private void AfterDeserialization() {
    6565      foreach (var model in Model.Models) {
    66         IRegressionProblemData problemData = (IRegressionProblemData) ProblemData.Clone();
     66        IRegressionProblemData problemData = (IRegressionProblemData)ProblemData.Clone();
    6767        problemData.TrainingPartition.Start = trainingPartitions[model].Start;
    6868        problemData.TrainingPartition.End = trainingPartitions[model].End;
     
    202202
    203203    public IEnumerable<IEnumerable<double>> GetEstimatedValueVectors(Dataset dataset, IEnumerable<int> rows) {
     204      if (!Model.Models.Any()) yield break;
    204205      var estimatedValuesEnumerators = (from model in Model.Models
    205206                                        select model.GetEstimatedValues(dataset, rows).GetEnumerator())
Note: See TracChangeset for help on using the changeset viewer.