Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs	(revision 6252)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleSolution.cs	(revision 6254)
@@ -106,6 +106,5 @@
 
           var selectedEnumerators = from pair in estimatedValuesEnumerators
-                                    where trainingPartitions == null || !trainingPartitions.ContainsKey(pair.Model) ||
-                                         (trainingPartitions[pair.Model].Start <= currentRow && currentRow < trainingPartitions[pair.Model].End)
+                                    where RowIsTrainingForModel(currentRow, pair.Model) && !RowIsTestForModel(currentRow, pair.Model)
                                     select pair.EstimatedValuesEnumerator;
           yield return AggregateEstimatedClassValues(selectedEnumerators.Select(x => x.Current));
@@ -126,6 +125,5 @@
 
           var selectedEnumerators = from pair in estimatedValuesEnumerators
-                                    where testPartitions == null || !testPartitions.ContainsKey(pair.Model) ||
-                                      (testPartitions[pair.Model].Start <= currentRow && currentRow < testPartitions[pair.Model].End)
+                                    where RowIsTestForModel(currentRow, pair.Model)
                                     select pair.EstimatedValuesEnumerator;
 
@@ -133,4 +131,14 @@
         }
       }
+    }
+
+    private bool RowIsTrainingForModel(int currentRow, IClassificationModel model) {
+      return trainingPartitions == null || !trainingPartitions.ContainsKey(model) ||
+              (trainingPartitions[model].Start <= currentRow && currentRow < trainingPartitions[model].End);
+    }
+
+    private bool RowIsTestForModel(int currentRow, IClassificationModel model) {
+      return testPartitions == null || !testPartitions.ContainsKey(model) ||
+              (testPartitions[model].Start <= currentRow && currentRow < testPartitions[model].End);
     }
 
@@ -156,4 +164,5 @@
       .OrderBy(g => -g.Count())
       .Select(g => g.Key)
+      .DefaultIfEmpty(double.NaN)
       .First();
     }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs	(revision 6252)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs	(revision 6254)
@@ -101,6 +101,5 @@
 
           var selectedEnumerators = from pair in estimatedValuesEnumerators
-                                    where trainingPartitions == null || !trainingPartitions.ContainsKey(pair.Model) ||
-                                         (trainingPartitions[pair.Model].Start <= currentRow && currentRow < trainingPartitions[pair.Model].End)
+                                    where RowIsTrainingForModel(currentRow, pair.Model) && !RowIsTestForModel(currentRow, pair.Model)
                                     select pair.EstimatedValuesEnumerator;
           yield return AggregateEstimatedValues(selectedEnumerators.Select(x => x.Current));
@@ -121,6 +120,5 @@
 
           var selectedEnumerators = from pair in estimatedValuesEnumerators
-                                    where testPartitions == null || !testPartitions.ContainsKey(pair.Model) ||
-                                      (testPartitions[pair.Model].Start <= currentRow && currentRow < testPartitions[pair.Model].End)
+                                    where RowIsTestForModel(currentRow, pair.Model)
                                     select pair.EstimatedValuesEnumerator;
 
@@ -128,4 +126,14 @@
         }
       }
+    }
+
+    private bool RowIsTrainingForModel(int currentRow, IRegressionModel model) {
+      return trainingPartitions == null || !trainingPartitions.ContainsKey(model) ||
+              (trainingPartitions[model].Start <= currentRow && currentRow < trainingPartitions[model].End);
+    }
+
+    private bool RowIsTestForModel(int currentRow, IRegressionModel model) {
+      return testPartitions == null || !testPartitions.ContainsKey(model) ||
+              (testPartitions[model].Start <= currentRow && currentRow < testPartitions[model].End);
     }
 
@@ -148,5 +156,5 @@
     private double AggregateEstimatedValues(IEnumerable<double> estimatedValues) {
       return estimatedValues.DefaultIfEmpty(double.NaN).Average();
-    }   
+    }
   }
 }
