Index: branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj
===================================================================
--- branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj	(revision 12409)
+++ branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj	(revision 12416)
@@ -188,4 +188,5 @@
     <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" />
     <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" />
+    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs" />
     <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs" />
     <Compile Include="SymbolicClassificationPhenotypicDiversityAnalyzer.cs" />
@@ -246,7 +247,4 @@
     </BootstrapperPackage>
   </ItemGroup>
-  <ItemGroup>
-    <WCFMetadata Include="Service References\" />
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
Index: branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs
===================================================================
--- branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs	(revision 12416)
+++ branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs	(revision 12416)
@@ -0,0 +1,145 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
+  [Item("Weighted Residuals Mean Squared Error Evaluator", @"A modified mean squared error evaluator that enables the possibility to weight residuals differently.
+The first residual category belongs to estimated values which obviously belong to a specific class because the estimated value is located above the maximum or below the minimum of all the class values (ObviousResidualsWeight).
+The second residual category represents residuals which belong to the positive class whereby the estimated value is located between the positive and a negative class (PositiveClassResidualsWeight).
+All other cases are represented by the third category (NegativeClassResidualsWeight).
+The weight is multiplied to the error before squaring which means that the Evaluator acts like a normal MSE-Evaluator if all the weights are set to 1.")]
+  [StorableClass]
+  public class SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
+    private const string ObviousResidualsWeightParameterName = "ObviousResidualsWeight";
+    private const string PositiveClassResidualsWeightParameterName = "PositiveClassResidualsWeight";
+    private const string NegativeClassResidualsWeightParameterName = "NegativeClassResidualsWeight";
+    [StorableConstructor]
+    protected SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
+    protected SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(this, cloner);
+    }
+
+    public SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator()
+      : base() {
+      Parameters.Add(new FixedValueParameter<DoubleValue>(ObviousResidualsWeightParameterName, "Weight of residuals which obviously belong to a specific class because the estimated values is located above the maximum or below the minimum of all the class values.", new DoubleValue(1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(PositiveClassResidualsWeightParameterName, "Weight of residuals which belong to the positive class whereby the estimated value is located between the positive and a negative class.", new DoubleValue(1)));
+      Parameters.Add(new FixedValueParameter<DoubleValue>(NegativeClassResidualsWeightParameterName, "Weight of residuals which are not covered by the ObviousResidualsWeight or the PositiveClassResidualsWeight.", new DoubleValue(1)));
+    }
+
+    #region parameter properties
+    public IFixedValueParameter<DoubleValue> ObviousResidualsWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[ObviousResidualsWeightParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> PositiveClassResidualsWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[PositiveClassResidualsWeightParameterName]; }
+    }
+    public IFixedValueParameter<DoubleValue> NegativeClassResidualsWeightParameter {
+      get { return (IFixedValueParameter<DoubleValue>)Parameters[NegativeClassResidualsWeightParameterName]; }
+    }
+    #endregion
+
+    #region properties
+    public override bool Maximization { get { return false; } }
+
+    public double ObviousResidualsWeight {
+      get {
+        return ObviousResidualsWeightParameter.Value.Value;
+      }
+    }
+    public double PositiveClassResidualsWeight {
+      get {
+        return PositiveClassResidualsWeightParameter.Value.Value;
+      }
+    }
+    public double NegativeClassResidualsWeight {
+      get {
+        return NegativeClassResidualsWeightParameter.Value.Value;
+      }
+    }
+    #endregion
+
+    public override IOperation InstrumentedApply() {
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value,
+        ObviousResidualsWeight, PositiveClassResidualsWeight, NegativeClassResidualsWeight);
+      QualityParameter.ActualValue = new DoubleValue(quality);
+      return base.InstrumentedApply();
+    }
+
+    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling,
+      double obviousResidualsWeight, double positiveClassResidualsWeight, double negativeClassResidualsWeight) {
+      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
+      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
+      OnlineCalculatorError errorState;
+
+      double positiveClassValue = problemData.GetClassValue(problemData.PositiveClass);
+      //get class values min/max
+      double classValuesMin = problemData.ClassValues.ElementAtOrDefault(0);
+      double classValuesMax = classValuesMin;
+      foreach (double classValue in problemData.ClassValues) {
+        if (classValuesMin > classValue) classValuesMin = classValue;
+        if (classValuesMax < classValue) classValuesMax = classValue;
+      }
+
+      double quality;
+      if (applyLinearScaling) {
+        var calculator = new OnlineWeightedResidualsMeanSquaredErrorCalculator(positiveClassValue, classValuesMax, classValuesMin,
+          obviousResidualsWeight, positiveClassResidualsWeight, negativeClassResidualsWeight);
+        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, calculator, problemData.Dataset.Rows);
+        errorState = calculator.ErrorState;
+        quality = calculator.WeightedResidualsMeanSquaredError;
+      } else {
+        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
+        quality = OnlineWeightedResidualsMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, positiveClassValue, classValuesMax,
+          classValuesMin, obviousResidualsWeight, positiveClassResidualsWeight, negativeClassResidualsWeight, out errorState);
+      }
+      if (errorState != OnlineCalculatorError.None) return Double.NaN;
+      return quality;
+    }
+
+    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, IClassificationProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      EstimationLimitsParameter.ExecutionContext = context;
+      ApplyLinearScalingParameter.ExecutionContext = context;
+
+      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, ObviousResidualsWeight, PositiveClassResidualsWeight, NegativeClassResidualsWeight);
+
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      EstimationLimitsParameter.ExecutionContext = null;
+      ApplyLinearScalingParameter.ExecutionContext = null;
+
+      return quality;
+    }
+  }
+}
Index: branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
===================================================================
--- branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 12409)
+++ branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 12416)
@@ -51,5 +51,5 @@
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
@@ -249,4 +249,5 @@
     <Compile Include="OnlineCalculators\OnlineMeanAbsolutePercentageErrorCalculator.cs" />
     <Compile Include="OnlineCalculators\OnlineMeanAndVarianceCalculator.cs" />
+    <Compile Include="OnlineCalculators\OnlineWeightedResidualsMeanSquaredErrorCalculator.cs" />
     <Compile Include="OnlineCalculators\OnlineMeanSquaredErrorCalculator.cs" />
     <Compile Include="OnlineCalculators\OnlineNormalizedMeanSquaredErrorCalculator.cs" />
Index: branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedResidualsMeanSquaredErrorCalculator.cs
===================================================================
--- branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedResidualsMeanSquaredErrorCalculator.cs	(revision 12416)
+++ branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedResidualsMeanSquaredErrorCalculator.cs	(revision 12416)
@@ -0,0 +1,118 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  public class OnlineWeightedResidualsMeanSquaredErrorCalculator : IOnlineCalculator {
+
+    private double sse;
+    private int n;
+    public double WeightedResidualsMeanSquaredError {
+      get {
+        return n > 0 ? sse / n : 0.0;
+      }
+    }
+
+    public double PositiveClassValue { get; private set; }
+    public double ClassValueMax { get; private set; }
+    public double ClassValueMin { get; private set; }
+    public double ObviousResidualsWeight { get; private set; }
+    public double PositiveClassResidualsWeight { get; private set; }
+    public double NegativeClassResidualsWeight { get; private set; }
+
+    public OnlineWeightedResidualsMeanSquaredErrorCalculator(double positiveClassValue, double classValueMax, double classValueMin,
+                                                                double obviousResidualsWeight, double positiveClassResidualsWeight, double negativeClassResidualsWeight) {
+      PositiveClassValue = positiveClassValue;
+      ClassValueMax = classValueMax;
+      ClassValueMin = classValueMin;
+      ObviousResidualsWeight = obviousResidualsWeight;
+      PositiveClassResidualsWeight = positiveClassResidualsWeight;
+      NegativeClassResidualsWeight = negativeClassResidualsWeight;
+      Reset();
+    }
+
+    #region IOnlineCalculator Members
+    private OnlineCalculatorError errorState;
+    public OnlineCalculatorError ErrorState {
+      get { return errorState; }
+    }
+    public double Value {
+      get { return WeightedResidualsMeanSquaredError; }
+    }
+    public void Reset() {
+      n = 0;
+      sse = 0.0;
+      errorState = OnlineCalculatorError.InsufficientElementsAdded;
+    }
+
+    public void Add(double original, double estimated) {
+      if (double.IsNaN(estimated) || double.IsInfinity(estimated) ||
+          double.IsNaN(original) || double.IsInfinity(original) || (errorState & OnlineCalculatorError.InvalidValueAdded) > 0) {
+        errorState = errorState | OnlineCalculatorError.InvalidValueAdded;
+      } else {
+        double error = estimated - original;
+        double weight;
+        //apply weight
+        if (estimated > ClassValueMax || estimated < ClassValueMin) {
+          weight = ObviousResidualsWeight;
+        } else if (original.IsAlmost(PositiveClassValue))
+        {
+          weight = PositiveClassResidualsWeight;
+        } else
+        {
+          weight = NegativeClassResidualsWeight;
+        }
+        error *= weight;
+        sse += error * error;
+        n++;
+        errorState = errorState & (~OnlineCalculatorError.InsufficientElementsAdded);        // n >= 1
+      }
+    }
+    #endregion
+
+    public static double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, double positiveClassValue, double classValueMax, double classValueMin,
+                                                                double obviousValuesWeight, double positiveClassValuesWeight, double negativeClassValuesWeight, out OnlineCalculatorError errorState) {
+      IEnumerator<double> originalEnumerator = originalValues.GetEnumerator();
+      IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator();
+      OnlineWeightedResidualsMeanSquaredErrorCalculator calculator = new OnlineWeightedResidualsMeanSquaredErrorCalculator(positiveClassValue, classValueMax, classValueMin, obviousValuesWeight, positiveClassValuesWeight, negativeClassValuesWeight);
+
+      // always move forward both enumerators (do not use short-circuit evaluation!)
+      while (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) {
+        double original = originalEnumerator.Current;
+        double estimated = estimatedEnumerator.Current;
+        calculator.Add(original, estimated);
+        if (calculator.ErrorState != OnlineCalculatorError.None) break;
+      }
+
+      // check if both enumerators are at the end to make sure both enumerations have the same length
+      if (calculator.ErrorState == OnlineCalculatorError.None &&
+         (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext())) {
+        throw new ArgumentException("Number of elements in originalValues and estimatedValues enumerations doesn't match.");
+      } else {
+        errorState = calculator.ErrorState;
+        return calculator.WeightedResidualsMeanSquaredError;
+      }
+    }
+  }
+}
