Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs	(revision 6238)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs	(revision 6238)
@@ -0,0 +1,65 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  [StorableClass]
+  [Item("RegressionEnsembleProblemData", "Represents an item containing all data defining a regression problem.")]
+  public sealed class RegressionEnsembleProblemData : RegressionProblemData {
+
+    public override IEnumerable<int> TrainingIndizes {
+      get {
+        return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start);
+      }
+    }
+
+    public override IEnumerable<int> TestIndizes {
+      get {
+        return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start);
+      }
+    }
+
+    [StorableConstructor]
+    private RegressionEnsembleProblemData(bool deserializing) : base(deserializing) { }
+
+    private RegressionEnsembleProblemData(RegressionEnsembleProblemData original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) { return new RegressionEnsembleProblemData(this, cloner); }
+
+    public RegressionEnsembleProblemData(IRegressionProblemData regressionProblemData)
+      : base(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable) {
+      TrainingPartition.Start = regressionProblemData.TrainingPartition.Start;
+      TrainingPartition.End = regressionProblemData.TrainingPartition.End;
+      TestPartition.Start = regressionProblemData.TestPartition.Start;
+      TestPartition.End = regressionProblemData.TestPartition.End;
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs	(revision 6184)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs	(revision 6238)
@@ -51,5 +51,5 @@
     }
     public RegressionEnsembleSolution(IEnumerable<IRegressionModel> models, IRegressionProblemData problemData)
-      : base(new RegressionEnsembleModel(models), problemData) {
+      : base(new RegressionEnsembleModel(models), new RegressionEnsembleProblemData(problemData)) {
       trainingPartitions = new Dictionary<IRegressionModel, IntRange>();
       testPartitions = new Dictionary<IRegressionModel, IntRange>();
@@ -62,5 +62,5 @@
 
     public RegressionEnsembleSolution(IEnumerable<IRegressionModel> models, IRegressionProblemData problemData, IEnumerable<IntRange> trainingPartitions, IEnumerable<IntRange> testPartitions)
-      : base(new RegressionEnsembleModel(models), problemData) {
+      : base(new RegressionEnsembleModel(models), new RegressionEnsembleProblemData(problemData)) {
       this.trainingPartitions = new Dictionary<IRegressionModel, IntRange>();
       this.testPartitions = new Dictionary<IRegressionModel, IntRange>();
@@ -75,36 +75,5 @@
         throw new ArgumentException();
       }
-
       RecalculateResults();
-    }
-
-    private void RecalculateResults() {
-      double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values
-      var trainingIndizes = Enumerable.Range(ProblemData.TrainingPartition.Start,
-        ProblemData.TrainingPartition.End - ProblemData.TrainingPartition.Start);
-      IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, trainingIndizes);
-      double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values
-      IEnumerable<double> originalTestValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TestIndizes);
-
-      OnlineCalculatorError errorState;
-      double trainingMSE = OnlineMeanSquaredErrorCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
-      TrainingMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingMSE : double.NaN;
-      double testMSE = OnlineMeanSquaredErrorCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);
-      TestMeanSquaredError = errorState == OnlineCalculatorError.None ? testMSE : double.NaN;
-
-      double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
-      TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR2 : double.NaN;
-      double testR2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);
-      TestRSquared = errorState == OnlineCalculatorError.None ? testR2 : double.NaN;
-
-      double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
-      TrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN;
-      double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);
-      TestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN;
-
-      double trainingNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);
-      TrainingNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingNMSE : double.NaN;
-      double testNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);
-      TestNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? testNMSE : double.NaN;
     }
 
@@ -115,9 +84,10 @@
     public override IEnumerable<double> EstimatedTrainingValues {
       get {
-        var rows = Enumerable.Range(ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End - ProblemData.TrainingPartition.Start);
+        var rows = ProblemData.TrainingIndizes;
         var estimatedValuesEnumerators = (from model in Model.Models
                                           select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() })
                                          .ToList();
         var rowsEnumerator = rows.GetEnumerator();
+        // aggregate to make sure that MoveNext is called for all enumerators 
         while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
           int currentRow = rowsEnumerator.Current;
@@ -134,8 +104,10 @@
     public override IEnumerable<double> EstimatedTestValues {
       get {
+        var rows = ProblemData.TestIndizes;
         var estimatedValuesEnumerators = (from model in Model.Models
-                                          select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, ProblemData.TestIndizes).GetEnumerator() })
+                                          select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() })
                                          .ToList();
         var rowsEnumerator = ProblemData.TestIndizes.GetEnumerator();
+        // aggregate to make sure that MoveNext is called for all enumerators 
         while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) {
           int currentRow = rowsEnumerator.Current;
@@ -168,5 +140,5 @@
 
     private double AggregateEstimatedValues(IEnumerable<double> estimatedValues) {
-      return estimatedValues.Average();
+      return estimatedValues.DefaultIfEmpty(double.NaN).Average();
     }
 
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs	(revision 6184)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs	(revision 6238)
@@ -33,5 +33,5 @@
   [StorableClass]
   [Item("RegressionProblemData", "Represents an item containing all data defining a regression problem.")]
-  public sealed class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData {
+  public class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData {
     private const string TargetVariableParameterName = "TargetVariable";
 
@@ -85,5 +85,5 @@
 
     [StorableConstructor]
-    private RegressionProblemData(bool deserializing) : base(deserializing) { }
+    protected RegressionProblemData(bool deserializing) : base(deserializing) { }
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
@@ -92,5 +92,5 @@
 
 
-    private RegressionProblemData(RegressionProblemData original, Cloner cloner)
+    protected RegressionProblemData(RegressionProblemData original, Cloner cloner)
       : base(original, cloner) {
       RegisterParameterEvents();
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs	(revision 6184)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs	(revision 6238)
@@ -55,40 +55,40 @@
     public double TrainingMeanSquaredError {
       get { return ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value = value; }
     }
 
     public double TestMeanSquaredError {
       get { return ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value = value; }
     }
 
     public double TrainingRSquared {
       get { return ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value = value; }
     }
 
     public double TestRSquared {
       get { return ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value = value; }
     }
 
     public double TrainingRelativeError {
       get { return ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value = value; }
     }
 
     public double TestRelativeError {
       get { return ((DoubleValue)this[TestRelativeErrorResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TestRelativeErrorResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TestRelativeErrorResultName].Value).Value = value; }
     }
 
     public double TrainingNormalizedMeanSquaredError {
       get { return ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value = value; }
     }
 
     public double TestNormalizedMeanSquaredError {
       get { return ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value; }
-      protected set { ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value = value; }
+      private set { ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value = value; }
     }
 
@@ -126,5 +126,5 @@
     }
 
-    private void RecalculateResults() {
+    protected void RecalculateResults() {
       double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values
       IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
