Index: /trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/ROCAnalyzer.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/ROCAnalyzer.cs	(revision 695)
+++ /trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/ROCAnalyzer.cs	(revision 696)
@@ -36,10 +36,10 @@
 
     public override string Description {
-      get { return @"Calculate TPR & FPR for various tresholds on dataset"; }
+      get { return @"Calculate TPR & FPR for various thresholds on dataset"; }
     }
 
     public ROCAnalyzer()
       : base() {
-      AddVariableInfo(new VariableInfo("Values", "Item list holding the estimated and orignial values for the ROCAnalyzer", typeof(ItemList), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Values", "Item list holding the estimated and original values for the ROCAnalyzer", typeof(ItemList), VariableKind.In));
       AddVariableInfo(new VariableInfo("ROCValues", "The values of the ROCAnalyzer, namely TPR & FPR", typeof(ItemList), VariableKind.New | VariableKind.Out));
       AddVariableInfo(new VariableInfo("AUCValues", "The AUC Values for each ROC", typeof(ItemList<DoubleData>), VariableKind.New | VariableKind.Out));
@@ -89,9 +89,5 @@
       foreach (double key in classes.Keys)
         classes[key].Sort();
-
-      //check for 2 classes classification problem
-      //if (classes.Keys.Count != 2)
-      //  throw new Exception("ROCAnalyser only handles  2 class classification problems");
-
+  
       //calculate ROC Curve
       foreach (double key in classes.Keys) {
@@ -103,6 +99,4 @@
 
     protected void CalculateBestROC(double positiveClassKey, SortedDictionary<double, List<double>> classes) {
-
-      int rocIndex = myRocValues.Count - 1;
       List<KeyValuePair<double, double>> rocCharacteristics;
       List<KeyValuePair<double, double>> bestROC;
@@ -132,6 +126,6 @@
         rocCharacteristics = null;
         bestROC = new List<KeyValuePair<double, double>>();
-        foreach (double minTreshold in classes[positiveClassKey].Distinct<double>()) {
-          CalculateROCValuesAndAUC(classes[positiveClassKey], actNegatives, negatives.Count, minTreshold, ref rocCharacteristics, out  actROC, out actAUC);
+        foreach (double minThreshold in classes[positiveClassKey].Distinct<double>()) {
+          CalculateROCValuesAndAUC(classes[positiveClassKey], actNegatives, negatives.Count, minThreshold, ref rocCharacteristics, out  actROC, out actAUC);
           if (actAUC > bestAUC) {
             bestAUC = actAUC;
@@ -154,5 +148,5 @@
     }
 
-    protected void CalculateROCValuesAndAUC(List<double> positives, List<double> negatives, int negativesCount, double minTreshold,
+    protected void CalculateROCValuesAndAUC(List<double> positives, List<double> negatives, int negativesCount, double minThreshold,
       ref List<KeyValuePair<double, double>> rocCharacteristics, out List<KeyValuePair<double, double>> roc, out double auc) {
       double actTP = -1;
@@ -163,6 +157,6 @@
       roc = new List<KeyValuePair<double, double>>();
 
-      actTP = positives.Count<double>(value => minTreshold <= value && value <= negatives.Max<double>());
-      actFP = negatives.Count<double>(value => minTreshold <= value && value <= negatives.Max<double>());
+      actTP = positives.Count<double>(value => minThreshold <= value && value <= negatives.Max<double>());
+      actFP = negatives.Count<double>(value => minThreshold <= value );
       //add point (1,TPR) for AUC 'correct' calculation
       roc.Add(new KeyValuePair<double, double>(1, actTP / positives.Count));
@@ -173,15 +167,15 @@
       if (rocCharacteristics == null) {
         rocCharacteristics = new List<KeyValuePair<double, double>>();
-        foreach (double maxTreshold in negatives.Distinct<double>()) {
+        foreach (double maxThreshold in negatives.Distinct<double>()) {
           auc += ((oldTP + actTP) / positives.Count) * ((oldFP - actFP) / negativesCount) / 2;
           oldTP = actTP;
           oldFP = actFP;
-          actTP = positives.Count<double>(value => minTreshold <= value && value < maxTreshold);
-          actFP = negatives.Count<double>(value => minTreshold <= value && value < maxTreshold);
+          actTP = positives.Count<double>(value => minThreshold <= value && value < maxThreshold);
+          actFP = negatives.Count<double>(value => minThreshold <= value && value < maxThreshold);
           rocCharacteristics.Add(new KeyValuePair<double, double>(oldTP - actTP, oldFP - actFP));
           roc.Add(new KeyValuePair<double, double>(actFP / negativesCount, actTP / positives.Count));
 
           //stop calculation if truePositiveRate == 0 => straight line with y=0 & save runtime
-          if ((actTP / positives.Count == 0) || (actFP / negatives.Count == 0))
+          if ((actTP == 0) || (actFP == 0))
             break;
         }
@@ -195,5 +189,5 @@
           actFP = oldFP - rocCharac.Value;
           roc.Add(new KeyValuePair<double, double>(actFP / negativesCount, actTP / positives.Count));
-          if (actTP / positives.Count == 0)
+          if ((actTP == 0) || (actFP == 0))
             break;
         }
@@ -219,14 +213,14 @@
       roc.Add(new KeyValuePair<double, double>(actFP / negativesCount, actTP / positives.Count));
 
-      foreach (double minTreshold in negatives.Distinct<double>()) {
+      foreach (double minThreshold in negatives.Distinct<double>()) {
         auc += ((oldTP + actTP) / positives.Count) * ((oldFP - actFP) / negativesCount) / 2;
         oldTP = actTP;
         oldFP = actFP;
-        actTP = positives.Count<double>(value => minTreshold <= value);
-        actFP = negatives.Count<double>(value => minTreshold <= value);
+        actTP = positives.Count<double>(value => minThreshold < value);
+        actFP = negatives.Count<double>(value => minThreshold < value);
         roc.Add(new KeyValuePair<double, double>(actFP / negativesCount, actTP / positives.Count));
 
         //stop calculation if truePositiveRate == 0 => straight line with y=0 & save runtime
-        if ((actTP / positives.Count == 0) || (actFP / negatives.Count == 0))
+        if (actTP == 0 || actFP==0)
           break;
       }
