Index: branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.Designer.cs
===================================================================
--- branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.Designer.cs	(revision 8329)
+++ branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.Designer.cs	(revision 8329)
@@ -0,0 +1,100 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 ClassificationEnsembleSolutionAccuracyToCoveredSamples {
+    /// <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() {
+      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
+      this.SamplesComboBox = new System.Windows.Forms.ComboBox();
+      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
+      this.SuspendLayout();
+      // 
+      // chart
+      // 
+      this.chart.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)));
+      chartArea1.Name = "ChartArea";
+      this.chart.ChartAreas.Add(chartArea1);
+      legend1.Alignment = System.Drawing.StringAlignment.Center;
+      legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
+      legend1.Name = "Default";
+      this.chart.Legends.Add(legend1);
+      this.chart.Location = new System.Drawing.Point(0, 30);
+      this.chart.Name = "chart";
+      this.chart.Size = new System.Drawing.Size(358, 195);
+      this.chart.TabIndex = 0;
+      // 
+      // 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(3, 3);
+      this.SamplesComboBox.Name = "SamplesComboBox";
+      this.SamplesComboBox.Size = new System.Drawing.Size(355, 21);
+      this.SamplesComboBox.TabIndex = 1;
+      this.SamplesComboBox.SelectedIndexChanged += new System.EventHandler(this.SamplesComboBox_SelectedIndexChanged);
+      // 
+      // ClassificationEnsembleSolutionConfidenceAccuracyDependence
+      // 
+      this.AllowDrop = true;
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.SamplesComboBox);
+      this.Controls.Add(this.chart);
+      this.Name = "ClassificationEnsembleSolutionConfidenceAccuracyDependence";
+      this.Size = new System.Drawing.Size(358, 225);
+      ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
+    private System.Windows.Forms.ComboBox SamplesComboBox;
+  }
+}
Index: branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs
===================================================================
--- branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs	(revision 8329)
+++ branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs	(revision 8329)
@@ -0,0 +1,188 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 System.Windows.Forms.DataVisualization.Charting;
+using HeuristicLab.Data;
+using HeuristicLab.MainForm;
+using HeuristicLab.Problems.DataAnalysis.Interfaces;
+
+namespace HeuristicLab.Problems.DataAnalysis.Views {
+  [View("Accuracy Covered Dependence")]
+  [Content(typeof(IClassificationEnsembleSolution))]
+  public partial class ClassificationEnsembleSolutionAccuracyToCoveredSamples : DataAnalysisSolutionEvaluationView {
+    private const string ACCURACYCOVERED = "Accuracy to Covered percentage";
+
+    private const string SamplesComboBoxAllSamples = "All Samples";
+    private const string SamplesComboBoxTrainingSamples = "Training Samples";
+    private const string SamplesComboBoxTestSamples = "Test Samples";
+
+    // zero is also a point
+    private const int maxPoints = 101;
+
+    public new ClassificationEnsembleSolution Content {
+      get { return (ClassificationEnsembleSolution)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public ClassificationEnsembleSolutionAccuracyToCoveredSamples()
+      : base() {
+      InitializeComponent();
+
+      SamplesComboBox.Items.AddRange(new string[] { SamplesComboBoxAllSamples, SamplesComboBoxTrainingSamples, SamplesComboBoxTestSamples });
+      SamplesComboBox.SelectedIndex = 0;
+      //configure axis
+      this.chart.CustomizeAllChartAreas();
+      this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
+      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
+      this.chart.ChartAreas[0].AxisX.IsStartedFromZero = true;
+      this.chart.ChartAreas[0].AxisX.Minimum = 0;
+      this.chart.ChartAreas[0].AxisX.Maximum = 1;
+      this.chart.ChartAreas[0].AxisX.Title = "Covered Samples in %";
+
+      this.chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
+      this.chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
+      this.chart.ChartAreas[0].AxisY.IsStartedFromZero = true;
+      this.chart.ChartAreas[0].AxisY.Minimum = 0;
+      this.chart.ChartAreas[0].AxisY.Maximum = 1;
+      this.chart.ChartAreas[0].AxisY.Title = "Accuracy";
+    }
+
+    private void RedrawChart() {
+      this.chart.Series.Clear();
+      if (Content != null) {
+
+        double[] accuracy = new double[maxPoints + 1];
+        double[] covered = new double[maxPoints + 1];
+
+        IClassificationEnsembleSolutionWeightCalculator weightCalc = Content.WeightCalculator;
+        var solutions = Content.ClassificationSolutions;
+        double[] estimatedClassValues;
+        double[] classValues;
+        OnlineAccuracyCalculator accuracyCalc = new OnlineAccuracyCalculator();
+
+        int rows;
+        double[] confidences;
+
+        if (SamplesComboBox.SelectedItem.ToString().Equals(SamplesComboBoxAllSamples)) {
+          rows = Content.ProblemData.Dataset.Rows;
+          estimatedClassValues = Content.EstimatedClassValues.ToArray();
+          classValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray();
+          confidences = weightCalc.GetConfidence(solutions, Enumerable.Range(0, rows), estimatedClassValues).ToArray();
+        } else {
+          IntRange range;
+          if (SamplesComboBox.SelectedItem.ToString().Equals(SamplesComboBoxTrainingSamples)) {
+            range = Content.ProblemData.TrainingPartition;
+            estimatedClassValues = Content.EstimatedTrainingClassValues.ToArray();
+          } else if (SamplesComboBox.SelectedItem.ToString().Equals(SamplesComboBoxTestSamples)) {
+            range = Content.ProblemData.TestPartition;
+            estimatedClassValues = Content.EstimatedTestClassValues.ToArray();
+          } else {
+            return;
+          }
+          rows = range.End - range.Start;
+          classValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable)
+                                      .Skip(range.Start).Take(range.End - range.Start).ToArray();
+          confidences = new double[rows];
+          int index;
+          for (int i = 0; i < rows; i++) {
+            index = range.Start + i;
+            confidences[i] = weightCalc.GetConfidence(GetRelevantSolutions(SamplesComboBox.SelectedItem.ToString(), solutions, index),
+                                                      index, estimatedClassValues[i]);
+          }
+        }
+
+        for (int i = 0; i < maxPoints; i++) {
+          double confidenceValue = (1.0 / (maxPoints - 1)) * i;
+          int notCovered = 0;
+
+          for (int j = 0; j < rows; j++) {
+            if (confidences[j] >= confidenceValue) {
+              accuracyCalc.Add(classValues[j], estimatedClassValues[j]);
+            } else {
+              notCovered++;
+            }
+          }
+
+          accuracy[i + 1] = accuracyCalc.Accuracy;
+          covered[i] = 1.0 - (double)notCovered / (double)rows;
+          accuracyCalc.Reset();
+        }
+
+        accuracy[0] = accuracy[1];
+        covered[maxPoints] = 0.0;
+
+        accuracy = accuracy.Reverse().ToArray();
+        covered = covered.Reverse().ToArray();
+
+
+
+        Series serie = this.chart.Series.Add(ACCURACYCOVERED);
+        serie.LegendText = ACCURACYCOVERED;
+        serie.ChartType = SeriesChartType.StepLine;
+        //serie.MarkerStyle = MarkerStyle.Diamond;
+        //serie.MarkerSize = 5;
+        serie.Points.DataBindXY(covered, accuracy);
+      }
+    }
+
+    protected IEnumerable<IClassificationSolution> GetRelevantSolutions(string samplesSelection, IEnumerable<IClassificationSolution> solutions, int curRow) {
+      if (samplesSelection == SamplesComboBoxAllSamples)
+        return solutions;
+      else if (samplesSelection == SamplesComboBoxTrainingSamples)
+        return solutions.Where(s => s.ProblemData.IsTrainingSample(curRow));
+      else if (samplesSelection == SamplesComboBoxTestSamples)
+        return solutions.Where(s => s.ProblemData.IsTestSample(curRow));
+      else
+        return new List<IClassificationSolution>();
+    }
+
+    #region events
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.ModelChanged += new EventHandler(Content_ModelChanged);
+      Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged);
+    }
+    protected override void DeregisterContentEvents() {
+      base.DeregisterContentEvents();
+      Content.ModelChanged -= new EventHandler(Content_ModelChanged);
+      Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged);
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      RedrawChart();
+    }
+    private void Content_ProblemDataChanged(object sender, EventArgs e) {
+      RedrawChart();
+    }
+    private void Content_ModelChanged(object sender, EventArgs e) {
+      RedrawChart();
+    }
+    private void SamplesComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      RedrawChart();
+    }
+    #endregion
+  }
+}
Index: branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
===================================================================
--- branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj	(revision 8297)
+++ branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj	(revision 8329)
@@ -160,4 +160,10 @@
       <DependentUpon>ClassificationEnsembleSolutionConfidenceAccuracyDependence.cs</DependentUpon>
     </Compile>
+    <Compile Include="Classification\ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="Classification\ClassificationEnsembleSolutionAccuracyToCoveredSamples.Designer.cs">
+      <DependentUpon>ClassificationEnsembleSolutionAccuracyToCoveredSamples.cs</DependentUpon>
+    </Compile>
     <Compile Include="DataAnalysisSolutionEvaluationView.cs">
       <SubType>UserControl</SubType>
