Index: /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs
===================================================================
--- /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs	(revision 8861)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs	(revision 8862)
@@ -82,42 +82,49 @@
         var solutions = Content.ClassificationSolutions;
         double[] estimatedClassValues = null;
-        double[] classValues;
+        double[] target;
         OnlineAccuracyCalculator accuracyCalc = new OnlineAccuracyCalculator();
 
-        int rows = 0;
-        double[] confidences = null;
-
-        classValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray();
-
-        if (SamplesComboBox.SelectedItem.ToString().Equals(SamplesComboBoxAllSamples)) {
-          rows = Content.ProblemData.Dataset.Rows;
-          estimatedClassValues = Content.EstimatedClassValues.ToArray();
-          confidences = weightCalc.GetConfidence(solutions,
-                                                 Enumerable.Range(0, Content.ProblemData.Dataset.Rows),
-                                                 estimatedClassValues,
-                                                 weightCalc.GetAllClassDelegate()).ToArray();
-        } else if (SamplesComboBox.SelectedItem.ToString().Equals(SamplesComboBoxTrainingSamples)) {
-          rows = Content.ProblemData.TrainingIndices.Count();
-          estimatedClassValues = Content.EstimatedTrainingClassValues.ToArray();
-          confidences = weightCalc.GetConfidence(solutions,
-                                                 Content.ProblemData.TrainingIndices,
-                                                 estimatedClassValues,
-                                                 weightCalc.GetTrainingClassDelegate()).ToArray();
-        } else if (SamplesComboBox.SelectedItem.ToString().Equals(SamplesComboBoxTestSamples)) {
-          rows = Content.ProblemData.TestIndices.Count();
-          estimatedClassValues = Content.EstimatedTestClassValues.ToArray();
-          confidences = weightCalc.GetConfidence(solutions,
-                                                 Content.ProblemData.TestIndices,
-                                                 estimatedClassValues,
-                                                 weightCalc.GetTestClassDelegate()).ToArray();
+        int[] indizes;
+        double[] confidences;
+
+        target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray();
+        switch (SamplesComboBox.SelectedItem.ToString()) {
+          case SamplesComboBoxAllSamples:
+            indizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray();
+            estimatedClassValues = Content.EstimatedClassValues.ToArray();
+            confidences = weightCalc.GetConfidence(solutions,
+                                                   Enumerable.Range(0, Content.ProblemData.Dataset.Rows),
+                                                   estimatedClassValues,
+                                                   weightCalc.GetAllClassDelegate()).ToArray();
+            break;
+          case SamplesComboBoxTrainingSamples:
+            indizes = Content.ProblemData.TrainingIndices.ToArray();
+            estimatedClassValues = Content.EstimatedTrainingClassValues.ToArray();
+            confidences = weightCalc.GetConfidence(solutions,
+                                                   Content.ProblemData.TrainingIndices,
+                                                   estimatedClassValues,
+                                                   weightCalc.GetTrainingClassDelegate()).ToArray();
+            break;
+          case SamplesComboBoxTestSamples:
+            indizes = Content.ProblemData.TestIndices.ToArray();
+            estimatedClassValues = Content.EstimatedTestClassValues.ToArray();
+            confidences = weightCalc.GetConfidence(solutions,
+                                                   Content.ProblemData.TestIndices,
+                                                   estimatedClassValues,
+                                                   weightCalc.GetTestClassDelegate()).ToArray();
+            break;
+          default:
+            throw new ArgumentException();
         }
 
+        int row;
         for (int i = 0; i < maxPoints; i++) {
           double confidenceValue = (1.0 / (maxPoints - 1)) * i;
           int notCovered = 0;
 
-          for (int j = 0; j < rows; j++) {
+          for (int j = 0; j < indizes.Length; j++) {
+            row = indizes[j];
             if (confidences[j] >= confidenceValue) {
-              accuracyCalc.Add(classValues[j], estimatedClassValues[j]);
+              accuracyCalc.Add(target[row], estimatedClassValues[j]);
             } else {
               notCovered++;
@@ -126,6 +133,6 @@
 
           accuracy[i + 1] = accuracyCalc.Accuracy;
-          if (rows > 0) {
-            covered[i] = 1.0 - (double)notCovered / (double)rows;
+          if (indizes.Length > 0) {
+            covered[i] = 1.0 - (double)notCovered / (double)indizes.Length;
           }
           accuracyCalc.Reset();
