Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs	(revision 6672)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs	(revision 6672)
@@ -0,0 +1,101 @@
+﻿#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
+namespace HeuristicLab.Problems.DataAnalysis.Views {
+  partial class ClassificationEnsembleSolutionEstimatedClassValuesView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.problemView1 = new HeuristicLab.Optimization.Views.ProblemView();
+      this.SamplesComboBox = new System.Windows.Forms.ComboBox();
+      this.SuspendLayout();
+      // 
+      // matrixView
+      // 
+      this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.matrixView.Dock = System.Windows.Forms.DockStyle.None;
+      this.matrixView.Location = new System.Drawing.Point(3, 31);
+      this.matrixView.Size = new System.Drawing.Size(304, 251);
+      // 
+      // problemView1
+      // 
+      this.problemView1.Caption = "Problem View";
+      this.problemView1.Content = null;
+      this.problemView1.Location = new System.Drawing.Point(1147, 687);
+      this.problemView1.Name = "problemView1";
+      this.problemView1.ReadOnly = false;
+      this.problemView1.Size = new System.Drawing.Size(490, 353);
+      this.problemView1.TabIndex = 1;
+      // 
+      // SamplesComboBox
+      // 
+      this.SamplesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.SamplesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+      this.SamplesComboBox.FormattingEnabled = true;
+      this.SamplesComboBox.Location = new System.Drawing.Point(4, 4);
+      this.SamplesComboBox.Name = "SamplesComboBox";
+      this.SamplesComboBox.Size = new System.Drawing.Size(303, 21);
+      this.SamplesComboBox.TabIndex = 2;
+      this.SamplesComboBox.SelectedIndexChanged += new System.EventHandler(this.SamplesComboBox_SelectedIndexChanged);
+      // 
+      // ClassificationEnsembleSolutionEstimatedClassValuesView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.SamplesComboBox);
+      this.Controls.Add(this.problemView1);
+      this.Name = "ClassificationEnsembleSolutionEstimatedClassValuesView";
+      this.Controls.SetChildIndex(this.matrixView, 0);
+      this.Controls.SetChildIndex(this.problemView1, 0);
+      this.Controls.SetChildIndex(this.SamplesComboBox, 0);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private Optimization.Views.ProblemView problemView1;
+    private System.Windows.Forms.ComboBox SamplesComboBox;
+
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs	(revision 6672)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs	(revision 6672)
@@ -0,0 +1,155 @@
+﻿#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.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Data;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+
+namespace HeuristicLab.Problems.DataAnalysis.Views {
+  [View("Estimated Class Values")]
+  [Content(typeof(ClassificationEnsembleSolution))]
+  public partial class ClassificationEnsembleSolutionEstimatedClassValuesView :
+    ClassificationSolutionEstimatedClassValuesView {
+    private const string RowColumnName = "Row";
+    private const string TargetClassValuesColumnName = "TargetVariable";
+    private const string EstimatedClassValuesColumnName = "EstimatedClassValues";
+    private const string ConfidenceColumnName = "Confidence";
+
+    private const string SamplesComboBoxAllSamples = "All Samples";
+    private const string SamplesComboBoxTrainingSamples = "Training Samples";
+    private const string SamplesComboBoxTestSamples = "Test Samples";
+
+    public new ClassificationEnsembleSolution Content {
+      get { return (ClassificationEnsembleSolution)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public ClassificationEnsembleSolutionEstimatedClassValuesView()
+      : base() {
+      InitializeComponent();
+      SamplesComboBox.Items.AddRange(new string[] { SamplesComboBoxAllSamples, SamplesComboBoxTrainingSamples, SamplesComboBoxTestSamples });
+      SamplesComboBox.SelectedIndex = 0;
+    }
+
+    private void SamplesComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      UpdateEstimatedValues();
+    }
+
+    protected override void UpdateEstimatedValues() {
+      if (InvokeRequired) {
+        Invoke((Action)UpdateEstimatedValues);
+        return;
+      }
+      if (Content == null) {
+        matrixView.Content = null;
+        return;
+      }
+
+      int[] indizes;
+      double[] estimatedClassValues;
+
+      switch (SamplesComboBox.SelectedItem.ToString()) {
+        case SamplesComboBoxAllSamples: {
+            indizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray();
+            estimatedClassValues = Content.EstimatedClassValues.ToArray();
+            break;
+          }
+        case SamplesComboBoxTrainingSamples: {
+            indizes = Content.ProblemData.TrainingIndizes.ToArray();
+            estimatedClassValues = Content.EstimatedTrainingClassValues.ToArray();
+            break;
+          }
+        case SamplesComboBoxTestSamples: {
+            indizes = Content.ProblemData.TestIndizes.ToArray();
+            estimatedClassValues = Content.EstimatedTestClassValues.ToArray();
+            break;
+          }
+        default:
+          throw new ArgumentException();
+      }
+
+      int classValuesCount = Content.ProblemData.ClassValues.Count;
+      int modelCount = Content.Model.Models.Count();
+      string[,] values = new string[indizes.Length, 4 + classValuesCount + modelCount];
+      double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable);
+      List<List<double?>> estimatedValuesVector = GetEstimatedValues(SamplesComboBox.SelectedItem.ToString(), indizes,
+                                                            Content.ClassificationSolutions);
+
+      for (int i = 0; i < indizes.Length; i++) {
+        int row = indizes[i];
+        values[i, 0] = row.ToString();
+        values[i, 1] = target[i].ToString();
+        values[i, 2] = estimatedClassValues[i].ToString();
+        var groups = estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList();
+        var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum();
+        values[i, 3] = (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString();
+        for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) {
+          var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault();
+          if (group == null) values[i, 4 + classIndex] = 0.ToString();
+          else values[i, 4 + classIndex] = group.Count.ToString();
+        }
+        for (int modelIndex = 0; modelIndex < estimatedValuesVector[i].Count; modelIndex++) {
+          values[i, 4 + classValuesCount + modelIndex] = estimatedValuesVector[i][modelIndex] == null
+                                                           ? string.Empty
+                                                           : estimatedValuesVector[i][modelIndex].ToString();
+        }
+
+      }
+
+      StringMatrix matrix = new StringMatrix(values);
+      List<string> columnNames = new List<string>() { "Id", TargetClassValuesColumnName, EstimatedClassValuesColumnName, ConfidenceColumnName };
+      columnNames.AddRange(Content.ProblemData.ClassNames);
+      columnNames.AddRange(Content.Model.Models.Select(m => m.Name));
+      matrix.ColumnNames = columnNames;
+      matrix.SortableView = true;
+      matrixView.Content = matrix;
+    }
+
+    private List<List<double?>> GetEstimatedValues(string samplesSelection, int[] rows, IEnumerable<IClassificationSolution> solutions) {
+      List<List<double?>> values = new List<List<double?>>();
+      int solutionIndex = 0;
+      foreach (var solution in solutions) {
+        double[] estimation = solution.GetEstimatedClassValues(rows).ToArray();
+        for (int i = 0; i < rows.Length; i++) {
+          var row = rows[i];
+          if (solutionIndex == 0) values.Add(new List<double?>());
+
+          if (samplesSelection == SamplesComboBoxAllSamples)
+            values[i].Add(estimation[i]);
+          else if (samplesSelection == SamplesComboBoxTrainingSamples && solution.ProblemData.IsTrainingSample(row))
+            values[i].Add(estimation[i]);
+          else if (samplesSelection == SamplesComboBoxTestSamples && solution.ProblemData.IsTestSample(row))
+            values[i].Add(estimation[i]);
+          else
+            values[i].Add(null);
+        }
+        solutionIndex++;
+      }
+      return values;
+    }
+
+
+
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj	(revision 6672)
@@ -110,4 +110,10 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs">
+      <DependentUpon>ClassificationEnsembleSolutionEstimatedClassValuesView.cs</DependentUpon>
+    </Compile>
     <Compile Include="Classification\ClassificationEnsembleSolutionModelView.cs">
       <SubType>UserControl</SubType>
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleProblemData.cs	(revision 6672)
@@ -21,5 +21,4 @@
 
 using System.Collections.Generic;
-using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -33,12 +32,15 @@
   public class ClassificationEnsembleProblemData : ClassificationProblemData {
 
-    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); }
+    public override bool IsTrainingSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+             TrainingPartition.Start <= index && index < TrainingPartition.End;
     }
 
-    private static ClassificationEnsembleProblemData emptyProblemData;
+    public override bool IsTestSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+             TestPartition.Start <= index && index < TestPartition.End;
+    }
+
+    private static readonly ClassificationEnsembleProblemData emptyProblemData;
     public static ClassificationEnsembleProblemData EmptyProblemData {
       get { return emptyProblemData; }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationProblemData.cs	(revision 6672)
@@ -171,9 +171,9 @@
      {1176881,7,5,3,7,4,10,7,5,5,4        }
 };
-    private static Dataset defaultDataset;
-    private static IEnumerable<string> defaultAllowedInputVariables;
-    private static string defaultTargetVariable;
-
-    private static ClassificationProblemData emptyProblemData;
+    private static readonly Dataset defaultDataset;
+    private static readonly IEnumerable<string> defaultAllowedInputVariables;
+    private static readonly string defaultTargetVariable;
+
+    private static readonly ClassificationProblemData emptyProblemData;
     public static ClassificationProblemData EmptyProblemData {
       get { return EmptyProblemData; }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs	(revision 6672)
@@ -78,5 +78,5 @@
       get {
         return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start)
-                         .Where(i => i >= 0 && i < Dataset.Rows && (i < TestPartition.Start || TestPartition.End <= i));
+                         .Where(IsTrainingSample);
       }
     }
@@ -84,6 +84,17 @@
       get {
         return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start)
-           .Where(i => i >= 0 && i < Dataset.Rows);
+           .Where(IsTestSample);
       }
+    }
+
+    public virtual bool IsTrainingSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+        TrainingPartition.Start <= index && index < TrainingPartition.End &&
+        (index < TestPartition.Start || TestPartition.End <= index);
+    }
+
+    public virtual bool IsTestSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+             TestPartition.Start <= index && index < TestPartition.End;
     }
     #endregion
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleProblemData.cs	(revision 6672)
@@ -21,5 +21,4 @@
 
 using System.Collections.Generic;
-using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -33,17 +32,15 @@
   public sealed class RegressionEnsembleProblemData : RegressionProblemData {
 
-    public override IEnumerable<int> TrainingIndizes {
-      get {
-        return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start);
-      }
+    public override bool IsTrainingSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+             TrainingPartition.Start <= index && index < TrainingPartition.End;
     }
 
-    public override IEnumerable<int> TestIndizes {
-      get {
-        return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start);
-      }
+    public override bool IsTestSample(int index) {
+      return index >= 0 && index < Dataset.Rows &&
+             TestPartition.Start <= index && index < TestPartition.End;
     }
 
-    private static RegressionEnsembleProblemData emptyProblemData;
+    private static readonly RegressionEnsembleProblemData emptyProblemData;
     public new static RegressionEnsembleProblemData EmptyProblemData {
       get { return emptyProblemData; }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs	(revision 6672)
@@ -64,9 +64,9 @@
           {0.83763905,	0.468046718}
     };
-    private static Dataset defaultDataset;
-    private static IEnumerable<string> defaultAllowedInputVariables;
-    private static string defaultTargetVariable;
+    private static readonly Dataset defaultDataset;
+    private static readonly IEnumerable<string> defaultAllowedInputVariables;
+    private static readonly string defaultTargetVariable;
 
-    private static RegressionProblemData emptyProblemData;
+    private static readonly RegressionProblemData emptyProblemData;
     public static RegressionProblemData EmptyProblemData {
       get { return emptyProblemData; }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs	(revision 6671)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs	(revision 6672)
@@ -39,4 +39,7 @@
     IEnumerable<int> TestIndizes { get; }
 
+    bool IsTrainingSample(int index);
+    bool IsTestSample(int index);
+
     event EventHandler Changed;
   }
