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 7728)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj	(revision 7729)
@@ -97,16 +97,32 @@
     <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Core.Views-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Data.Views-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Optimization.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Optimizer-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Parameters.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Optimization.Views-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimizer-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimizer-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters.Views-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters.Views-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">
Index: /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
===================================================================
--- /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 7728)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 7729)
@@ -93,13 +93,31 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
-    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Collections-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core">
@@ -129,6 +147,8 @@
     <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationSolutionBase.cs" />
     <Compile Include="Implementation\Classification\WeightCalculators\AccuracyWeightCalculator.cs" />
+    <Compile Include="Implementation\Classification\WeightCalculators\AverageThresholdCalculator.cs" />
     <Compile Include="Implementation\Classification\WeightCalculators\ContinuousPointCertaintyWeightCalculator.cs" />
     <Compile Include="Implementation\Classification\WeightCalculators\DiscriminantClassificationWeightCalculator.cs" />
+    <Compile Include="Implementation\Classification\WeightCalculators\MedianPointThresholdCalculator.cs" />
     <Compile Include="Implementation\Classification\WeightCalculators\MedianThresholdCalculator.cs" />
     <Compile Include="Implementation\Classification\WeightCalculators\NeighbourhoodWeightCalculator.cs" />
Index: /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AverageThresholdCalculator.cs
===================================================================
--- /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AverageThresholdCalculator.cs	(revision 7729)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/AverageThresholdCalculator.cs	(revision 7729)
@@ -0,0 +1,108 @@
+﻿#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.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  [StorableClass]
+  [Item("AverageThresholdCalculator", "")]
+  public class AverageThresholdCalculator : DiscriminantClassificationWeightCalculator {
+
+    public AverageThresholdCalculator()
+      : base() {
+    }
+    [StorableConstructor]
+    protected AverageThresholdCalculator(bool deserializing) : base(deserializing) { }
+    protected AverageThresholdCalculator(AverageThresholdCalculator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AverageThresholdCalculator(this, cloner);
+    }
+
+    protected double[] threshold;
+    protected double[] classValues;
+
+    protected override IEnumerable<double> DiscriminantCalculateWeights(IEnumerable<IDiscriminantFunctionClassificationSolution> discriminantSolutions) {
+      classValues = discriminantSolutions.First().Model.ClassValues.ToArray();
+      var modelThresholds = discriminantSolutions.Select(x => x.Model.Thresholds.ToArray());
+      threshold = new double[modelThresholds.First().GetLength(0)];
+      for (int i = 0; i < modelThresholds.First().GetLength(0); i++) {
+        threshold[i] = modelThresholds.Select(x => x[i]).Average();
+      }
+      return Enumerable.Repeat<double>(1, discriminantSolutions.Count());
+    }
+
+    protected override double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {
+      IList<double> values = estimatedValues.Select(x => x.Value).ToList();
+      if (values.Count <= 0)
+        return double.NaN;
+      double avg = values.Average();
+      return GetClassValueToAverage(avg);
+    }
+    private double GetClassValueToAverage(double avg) {
+      double classValue = classValues.First();
+      for (int i = 0; i < classValues.Count(); i++) {
+        if (avg > threshold[i])
+          classValue = classValues[i];
+        else
+          break;
+      }
+      return classValue;
+    }
+
+    protected override double GetDiscriminantConfidence(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, int index, double estimatedClassValue) {
+      // only works with binary classification
+      if (!classValues.Count().Equals(2))
+        return double.NaN;
+      Dataset dataset = solutions.First().ProblemData.Dataset;
+      IList<double> values = solutions.Select(s => s.Model.GetEstimatedValues(dataset, Enumerable.Repeat(index, 1)).First()).ToList();
+      if (values.Count <= 0)
+        return double.NaN;
+      double avg = values.Average();
+      if (estimatedClassValue.Equals(classValues[0])) {
+        if (avg < estimatedClassValue)
+          return 1;
+        else if (avg >= threshold[1])
+          return 0;
+        else {
+          double distance = threshold[1] - classValues[0];
+          return (1 / distance) * (threshold[1] - avg);
+        }
+      } else if (estimatedClassValue.Equals(classValues[1])) {
+        if (avg > estimatedClassValue)
+          return 1;
+        else if (avg <= threshold[1])
+          return 0;
+        else {
+          double distance = classValues[1] - threshold[1];
+          return (1 / distance) * (avg - threshold[1]);
+        }
+      } else
+        return double.NaN;
+    }
+  }
+}
Index: /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/DiscriminantClassificationWeightCalculator.cs
===================================================================
--- /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/DiscriminantClassificationWeightCalculator.cs	(revision 7728)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/DiscriminantClassificationWeightCalculator.cs	(revision 7729)
@@ -59,5 +59,5 @@
 
       IEnumerable<IDictionary<IClassificationSolution, double>> estimatedClassValues = GetEstimatedClassValues(solutions, dataset, rows, handler);
-      IEnumerable<IDictionary<IClassificationSolution, double>> estimatedValues = GetEstimatedValues(discriminantSolutions, dataset, rows, handler);
+      IEnumerable<IDictionary<IDiscriminantFunctionClassificationSolution, double>> estimatedValues = GetEstimatedValues(discriminantSolutions, dataset, rows, handler);
 
       return from zip in estimatedClassValues.Zip(estimatedValues, (classValues, values) => new { ClassValues = classValues, Values = values })
@@ -65,11 +65,11 @@
     }
 
-    protected virtual double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IClassificationSolution, double> estimatedValues) {
+    protected virtual double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {
       return AggregateEstimatedClassValues(estimatedClassValues);
     }
 
-    protected IEnumerable<IDictionary<IClassificationSolution, double>> GetEstimatedValues(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, Dataset dataset, IEnumerable<int> rows, CheckPoint handler) {
+    protected IEnumerable<IDictionary<IDiscriminantFunctionClassificationSolution, double>> GetEstimatedValues(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, Dataset dataset, IEnumerable<int> rows, CheckPoint handler) {
       var estimatedValuesEnumerators = (from solution in solutions
-                                        select new { Solution = solution, EstimatedValuesEnumerator = solution.Model.GetEstimatedClassValues(dataset, rows).GetEnumerator() })
+                                        select new { Solution = solution, EstimatedValuesEnumerator = solution.Model.GetEstimatedValues(dataset, rows).GetEnumerator() })
                                         .ToList();
 
@@ -79,5 +79,5 @@
                       where handler(enumerator.Solution.ProblemData, rowEnumerator.Current)
                       select enumerator)
-                      .ToDictionary(x => (IClassificationSolution)x.Solution, x => x.EstimatedValuesEnumerator.Current);
+                      .ToDictionary(x => x.Solution, x => x.EstimatedValuesEnumerator.Current);
       }
     }
Index: /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianPointThresholdCalculator.cs
===================================================================
--- /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianPointThresholdCalculator.cs	(revision 7729)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianPointThresholdCalculator.cs	(revision 7729)
@@ -0,0 +1,147 @@
+﻿#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.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  [StorableClass]
+  [Item("MedianPointThresholdCalculator", "")]
+  public class MedianPointThresholdCalculator : DiscriminantClassificationWeightCalculator {
+
+    public MedianPointThresholdCalculator()
+      : base() {
+    }
+    [StorableConstructor]
+    protected MedianPointThresholdCalculator(bool deserializing) : base(deserializing) { }
+    protected MedianPointThresholdCalculator(MedianPointThresholdCalculator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MedianPointThresholdCalculator(this, cloner);
+    }
+
+    protected double[] threshold;
+    protected double[] classValues;
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="discriminantSolutions"></param>
+    /// <returns>median instead of weights, because it doesn't use any weights</returns>
+    protected override IEnumerable<double> DiscriminantCalculateWeights(IEnumerable<IDiscriminantFunctionClassificationSolution> discriminantSolutions) {
+      List<List<double>> estimatedValues = new List<List<double>>();
+      List<List<double>> estimatedClassValues = new List<List<double>>();
+
+      List<IClassificationProblemData> solutionProblemData = discriminantSolutions.Select(sol => sol.ProblemData).ToList();
+      Dataset dataSet = solutionProblemData[0].Dataset;
+      IEnumerable<int> rows = Enumerable.Range(0, dataSet.Rows);
+      foreach (var solution in discriminantSolutions) {
+        estimatedValues.Add(solution.Model.GetEstimatedValues(dataSet, rows).ToList());
+        estimatedClassValues.Add(solution.Model.GetEstimatedValues(dataSet, rows).ToList());
+      }
+
+      List<double> median = new List<double>();
+      List<double> targetValues = dataSet.GetDoubleValues(solutionProblemData[0].TargetVariable).ToList();
+      IList<double> curTrainingpoints = new List<double>();
+      int removed = 0;
+      int count = targetValues.Count;
+      for (int point = 0; point < count; point++) {
+        curTrainingpoints.Clear();
+        for (int solutionPos = 0; solutionPos < solutionProblemData.Count; solutionPos++) {
+          if (PointInTraining(solutionProblemData[solutionPos], point)) {
+            curTrainingpoints.Add(estimatedValues[solutionPos][point]);
+          }
+        }
+        if (curTrainingpoints.Count > 0)
+          median.Add(GetMedian(curTrainingpoints.OrderBy(p => p).ToList()));
+        else {
+          //remove not used points
+          targetValues.RemoveAt(point - removed);
+          removed++;
+        }
+      }
+      AccuracyMaximizationThresholdCalculator.CalculateThresholds(solutionProblemData[0], median, targetValues, out classValues, out threshold);
+      return Enumerable.Repeat<double>(1, discriminantSolutions.Count());
+    }
+
+    protected override double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {
+      IList<double> values = estimatedValues.Select(x => x.Value).ToList();
+      if (values.Count <= 0)
+        return double.NaN;
+      double median = GetMedian(values);
+      return GetClassValueToMedian(median);
+    }
+    private double GetClassValueToMedian(double median) {
+      double classValue = classValues.First();
+      for (int i = 0; i < classValues.Count(); i++) {
+        if (median > threshold[i])
+          classValue = classValues[i];
+        else
+          break;
+      }
+      return classValue;
+    }
+
+    protected override double GetDiscriminantConfidence(IEnumerable<IDiscriminantFunctionClassificationSolution> solutions, int index, double estimatedClassValue) {
+      // only works with binary classification
+      if (!classValues.Count().Equals(2))
+        return double.NaN;
+      Dataset dataset = solutions.First().ProblemData.Dataset;
+      IList<double> values = solutions.Select(s => s.Model.GetEstimatedValues(dataset, Enumerable.Repeat(index, 1)).First()).ToList();
+      if (values.Count <= 0)
+        return double.NaN;
+      double median = GetMedian(values);
+      if (estimatedClassValue.Equals(classValues[0])) {
+        if (median < estimatedClassValue)
+          return 1;
+        else if (median >= threshold[1])
+          return 0;
+        else {
+          double distance = threshold[1] - classValues[0];
+          return (1 / distance) * (median - classValues[0]);
+        }
+      } else if (estimatedClassValue.Equals(classValues[1])) {
+        if (median > estimatedClassValue)
+          return 1;
+        else if (median <= threshold[1])
+          return 0;
+        else {
+          double distance = classValues[1] - threshold[1];
+          return (1 / distance) * (classValues[1] - median);
+        }
+      } else
+        return double.NaN;
+    }
+
+    private double GetMedian(IList<double> estimatedValues) {
+      int count = estimatedValues.Count;
+      if (count % 2 == 0)
+        return 0.5 * (estimatedValues[count / 2 - 1] + estimatedValues[count / 2]);
+      else
+        return estimatedValues[count / 2];
+    }
+  }
+}
Index: /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianThresholdCalculator.cs
===================================================================
--- /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianThresholdCalculator.cs	(revision 7728)
+++ /branches/ClassificationEnsembleVoting/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/WeightCalculators/MedianThresholdCalculator.cs	(revision 7729)
@@ -47,46 +47,15 @@
     protected double[] classValues;
 
-    /// <summary>
-    /// 
-    /// </summary>
-    /// <param name="discriminantSolutions"></param>
-    /// <returns>median instead of weights, because it doesn't use any weights</returns>
     protected override IEnumerable<double> DiscriminantCalculateWeights(IEnumerable<IDiscriminantFunctionClassificationSolution> discriminantSolutions) {
-      List<List<double>> estimatedValues = new List<List<double>>();
-      List<List<double>> estimatedClassValues = new List<List<double>>();
-
-      List<IClassificationProblemData> solutionProblemData = discriminantSolutions.Select(sol => sol.ProblemData).ToList();
-      Dataset dataSet = solutionProblemData[0].Dataset;
-      IEnumerable<int> rows = Enumerable.Range(0, dataSet.Rows);
-      foreach (var solution in discriminantSolutions) {
-        estimatedValues.Add(solution.Model.GetEstimatedValues(dataSet, rows).ToList());
-        estimatedClassValues.Add(solution.Model.GetEstimatedValues(dataSet, rows).ToList());
+      classValues = discriminantSolutions.First().Model.ClassValues.ToArray();
+      var modelThresholds = discriminantSolutions.Select(x => x.Model.Thresholds.ToArray());
+      threshold = new double[modelThresholds.First().GetLength(0)];
+      for (int i = 0; i < modelThresholds.First().GetLength(0); i++) {
+        threshold[i] = GetMedian(modelThresholds.Select(x => x[i]).ToList());
       }
-
-      List<double> median = new List<double>();
-      List<double> targetValues = dataSet.GetDoubleValues(solutionProblemData[0].TargetVariable).ToList();
-      IList<double> curTrainingpoints = new List<double>();
-      int removed = 0;
-      int count = targetValues.Count;
-      for (int point = 0; point < count; point++) {
-        curTrainingpoints.Clear();
-        for (int solutionPos = 0; solutionPos < solutionProblemData.Count; solutionPos++) {
-          if (PointInTraining(solutionProblemData[solutionPos], point)) {
-            curTrainingpoints.Add(estimatedValues[solutionPos][point]);
-          }
-        }
-        if (curTrainingpoints.Count > 0)
-          median.Add(GetMedian(curTrainingpoints.OrderBy(p => p).ToList()));
-        else {
-          //remove not used points
-          targetValues.RemoveAt(point - removed);
-          removed++;
-        }
-      }
-      AccuracyMaximizationThresholdCalculator.CalculateThresholds(solutionProblemData[0], median, targetValues, out classValues, out threshold);
       return Enumerable.Repeat<double>(1, discriminantSolutions.Count());
     }
 
-    protected override double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IClassificationSolution, double> estimatedValues) {
+    protected override double DiscriminantAggregateEstimatedClassValues(IDictionary<IClassificationSolution, double> estimatedClassValues, IDictionary<IDiscriminantFunctionClassificationSolution, double> estimatedValues) {
       IList<double> values = estimatedValues.Select(x => x.Value).ToList();
       if (values.Count <= 0)
@@ -122,5 +91,5 @@
         else {
           double distance = threshold[1] - classValues[0];
-          return (1 / distance) * (median - classValues[0]);
+          return (1 / distance) * (threshold[1] - median);
         }
       } else if (estimatedClassValue.Equals(classValues[1])) {
@@ -131,5 +100,5 @@
         else {
           double distance = classValues[1] - threshold[1];
-          return (1 / distance) * (classValues[1] - median);
+          return (1 / distance) * (median - threshold[1]);
         }
       } else
