Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/30/12 16:22:04 (11 years ago)
Author:
sforsten
Message:

#1776:

  • merged r8810:8862 from trunk into branch
  • fixed exception in ClassificationEnsembleSolutionAccuracyToCoveredSamples, if no estimated values are in a partition, so nothing can be shown
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/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs

    r8862 r8863  
    118118        }
    119119
    120         int row;
    121         for (int i = 0; i < maxPoints; i++) {
    122           double confidenceValue = (1.0 / (maxPoints - 1)) * i;
    123           int notCovered = 0;
    124 
    125           for (int j = 0; j < indizes.Length; j++) {
    126             row = indizes[j];
    127             if (confidences[j] >= confidenceValue) {
    128               accuracyCalc.Add(target[row], estimatedClassValues[j]);
    129             } else {
    130               notCovered++;
     120        if (!estimatedClassValues.All(x => Double.IsNaN(x))) {
     121          int row;
     122          for (int i = 0; i < maxPoints; i++) {
     123            double confidenceValue = (1.0 / (maxPoints - 1)) * i;
     124            int notCovered = 0;
     125
     126            for (int j = 0; j < indizes.Length; j++) {
     127              row = indizes[j];
     128              if (confidences[j] >= confidenceValue) {
     129                accuracyCalc.Add(target[row], estimatedClassValues[j]);
     130              } else {
     131                notCovered++;
     132              }
    131133            }
     134
     135            accuracy[i + 1] = accuracyCalc.Accuracy;
     136            if (indizes.Length > 0) {
     137              covered[i] = 1.0 - (double)notCovered / (double)indizes.Length;
     138            }
     139            accuracyCalc.Reset();
    132140          }
    133141
    134           accuracy[i + 1] = accuracyCalc.Accuracy;
    135           if (indizes.Length > 0) {
    136             covered[i] = 1.0 - (double)notCovered / (double)indizes.Length;
    137           }
    138           accuracyCalc.Reset();
     142          accuracy[0] = accuracy[1];
     143          covered[maxPoints] = 0.0;
     144
     145          accuracy = accuracy.Reverse().ToArray();
     146          covered = covered.Reverse().ToArray();
     147
     148          Series area = this.chart.Series.Add(AREA);
     149          area.ChartType = SeriesChartType.Area;
     150          area.Color = Color.LightBlue;
     151          IEnumerable<IEnumerable<double>> areaPoints = CalculateAreaPoints(covered, accuracy);
     152          area.Points.DataBindXY(areaPoints.ElementAt(0), areaPoints.ElementAt(1));
     153
     154          Series series = this.chart.Series.Add(ACCURACYCOVERED);
     155          series.Color = Color.Red;
     156          series.ChartType = SeriesChartType.FastPoint;
     157          series.MarkerStyle = MarkerStyle.Diamond;
     158          series.MarkerSize = 5;
     159          series.Points.DataBindXY(covered, accuracy);
     160
     161          double auc = CalculateAreaUnderCurve(series);
     162          area.LegendToolTip = "AUC: " + auc;
     163
     164          AUCLabel.Text = "AUC: " + auc;
     165        } else {
     166          AUCLabel.Text = "No values in this partition!";
    139167        }
    140 
    141         accuracy[0] = accuracy[1];
    142         covered[maxPoints] = 0.0;
    143 
    144         accuracy = accuracy.Reverse().ToArray();
    145         covered = covered.Reverse().ToArray();
    146 
    147         Series area = this.chart.Series.Add(AREA);
    148         area.ChartType = SeriesChartType.Area;
    149         area.Color = Color.LightBlue;
    150         IEnumerable<IEnumerable<double>> areaPoints = CalculateAreaPoints(covered, accuracy);
    151         area.Points.DataBindXY(areaPoints.ElementAt(0), areaPoints.ElementAt(1));
    152 
    153         Series series = this.chart.Series.Add(ACCURACYCOVERED);
    154         series.Color = Color.Red;
    155         series.ChartType = SeriesChartType.FastPoint;
    156         series.MarkerStyle = MarkerStyle.Diamond;
    157         series.MarkerSize = 5;
    158         series.Points.DataBindXY(covered, accuracy);
    159 
    160         double auc = CalculateAreaUnderCurve(series);
    161         area.LegendToolTip = "AUC: " + auc;
    162 
    163         AUCLabel.Text = "AUC: " + auc;
    164168      }
    165169    }
Note: See TracChangeset for help on using the changeset viewer.