Index: branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneR.cs
===================================================================
--- branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneR.cs	(revision 9119)
+++ branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneR.cs	(revision 9135)
@@ -84,4 +84,5 @@
       string bestVariable = null;
       Dictionary<double, double> bestSplits = null;
+      double missingValuesClass = double.NaN;
       int correctClassified = 0;
 
@@ -98,4 +99,18 @@
         bool done = false;
         int curRow = 0;
+
+        if (curRow < inputVariableValues.Length && Double.IsNaN(inputVariableValues[curRow])) {
+          while (curRow < inputVariableValues.Length && Double.IsNaN(inputVariableValues[curRow])) {
+            classCount[classValuesInDataset[curRow]] += 1;
+            curRow++;
+          }
+          if (ExistsDominatingClass(classCount, out dominatingClass)) {
+            missingValuesClass = dominatingClass;
+          } else {
+            missingValuesClass = GetRandomMaxClass(classCount, random);
+          }
+          correctClassified += classCount[missingValuesClass];
+          classCount = PrepareClassCountDictionary(classValues);
+        }
         while (curRow < inputVariableValues.Length) {
           if (newBucket) {
@@ -108,17 +123,15 @@
             }
             curSplit = inputVariableValues[curRow];
-            curRow = SetCurRowCorrectly(curRow, inputVariableValues, classValuesInDataset, classCount, curSplit);
+            curRow = SetCurRowToEndOfSplit(curRow, inputVariableValues, classValuesInDataset, classCount, curSplit);
             newBucket = false;
           }
-
 
           if (ExistsDominatingClass(classCount, out dominatingClass)) {
             while (curRow + 1 < classValuesInDataset.Length &&
-              IsNextSplitStillDominationClass(curRow, inputVariableValues, classValuesInDataset, curSplit, dominatingClass)) {
-              // curRow + i < classValuesInDataset.Length && classValuesInDataset[curRow + i] == dominatingClass) {
-              curSplit = inputVariableValues[curRow + 1];
-              classCount[classValuesInDataset[curRow + 1]] += 1;
+              IsNextSplitStillDominatingClass(curRow, inputVariableValues, classValuesInDataset, curSplit, dominatingClass)) {
               curRow++;
-              curRow = SetCurRowCorrectly(curRow, inputVariableValues, classValuesInDataset, classCount, curSplit);
+              curSplit = inputVariableValues[curRow];
+              classCount[classValuesInDataset[curRow]] += 1;
+              curRow = SetCurRowToEndOfSplit(curRow, inputVariableValues, classValuesInDataset, classCount, curSplit);
             }
 
@@ -144,5 +157,5 @@
             curSplit = inputVariableValues[curRow];
             classCount[classValuesInDataset[curRow]] += 1;
-            curRow = SetCurRowCorrectly(curRow, inputVariableValues, classValuesInDataset, classCount, curSplit);
+            curRow = SetCurRowToEndOfSplit(curRow, inputVariableValues, classValuesInDataset, classCount, curSplit);
           }
         }
@@ -150,20 +163,8 @@
         if (!done) {
           curSplit = Double.PositiveInfinity;
-
-          IList<double> possibleClasses = new List<double>();
-          int max = 0;
-          foreach (var item in classCount) {
-            if (max < item.Value) {
-              max = item.Value;
-              possibleClasses = new List<double>();
-              possibleClasses.Add(item.Key);
-            } else {
-              possibleClasses.Add(item.Key);
-            }
-          }
-          int classindex = random.Next(possibleClasses.Count);
-          splits.Add(curSplit, possibleClasses[classindex]);
-
-          curCorrectClassified += classCount[possibleClasses[classindex]];
+          double randomClass = GetRandomMaxClass(classCount, random);
+          splits.Add(curSplit, randomClass);
+
+          curCorrectClassified += classCount[randomClass];
         }
 
@@ -177,5 +178,5 @@
       Dictionary<double, double> mergedSplits = MergeSplits(bestSplits);
 
-      var model = new OneRClassificationModel(bestVariable, mergedSplits.Keys.ToArray(), mergedSplits.Values.ToArray());
+      var model = new OneRClassificationModel(bestVariable, mergedSplits.Keys.ToArray(), mergedSplits.Values.ToArray(), missingValuesClass);
       var solution = new OneRClassificationSolution(model, (IClassificationProblemData)problemData.Clone());
 
@@ -183,5 +184,21 @@
     }
 
-    private static bool IsNextSplitStillDominationClass(int curRow, double[] inputVariableValues, double[] classValuesInDataset, double curSplit, double dominatingClass) {
+    private static double GetRandomMaxClass(Dictionary<double, int> classCount, IRandom random) {
+      IList<double> possibleClasses = new List<double>();
+      int max = 0;
+      foreach (var item in classCount) {
+        if (max < item.Value) {
+          max = item.Value;
+          possibleClasses = new List<double>();
+          possibleClasses.Add(item.Key);
+        } else if (max == item.Value) {
+          possibleClasses.Add(item.Key);
+        }
+      }
+      int classindex = random.Next(possibleClasses.Count);
+      return possibleClasses[classindex];
+    }
+
+    private static bool IsNextSplitStillDominatingClass(int curRow, double[] inputVariableValues, double[] classValuesInDataset, double curSplit, double dominatingClass) {
       if (curRow >= classValuesInDataset.Length) {
         return false;
@@ -205,5 +222,6 @@
     }
 
-    private static int SetCurRowCorrectly(int curRow, double[] inputVariableValues, double[] classValuesInDataset, Dictionary<double, int> classCount, double curSplit) {
+    // needed if variable contains the same value several times
+    private static int SetCurRowToEndOfSplit(int curRow, double[] inputVariableValues, double[] classValuesInDataset, Dictionary<double, int> classCount, double curSplit) {
       while (curRow + 1 < inputVariableValues.Length && inputVariableValues[curRow + 1] == curSplit) {
         curRow++;
Index: branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneR/OneRClassificationModel.cs
===================================================================
--- branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneR/OneRClassificationModel.cs	(revision 9119)
+++ branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneR/OneRClassificationModel.cs	(revision 9135)
@@ -50,4 +50,10 @@
     }
 
+    [Storable]
+    protected double missingValuesClass;
+    public double MissingValuesClass {
+      get { return missingValuesClass; }
+    }
+
     [StorableConstructor]
     protected OneRClassificationModel(bool deserializing) : base(deserializing) { }
@@ -60,5 +66,5 @@
     public override IDeepCloneable Clone(Cloner cloner) { return new OneRClassificationModel(this, cloner); }
 
-    public OneRClassificationModel(string variable, double[] splits, double[] classes)
+    public OneRClassificationModel(string variable, double[] splits, double[] classes, double missingValuesClass = double.NaN)
       : base() {
       if (splits.Length != classes.Length) {
@@ -73,4 +79,5 @@
       this.splits = splits;
       this.classes = classes;
+      this.missingValuesClass = missingValuesClass;
     }
 
@@ -85,4 +92,8 @@
       Array.Sort(values, rowsArray);
       int curSplit = 0, curIndex = 0;
+      while (curIndex < values.Length && Double.IsNaN(values[curIndex])) {
+        estimated[curIndex] = MissingValuesClass;
+        curIndex++;
+      }
       while (curSplit < Splits.Length) {
         while (curIndex < values.Length && Splits[curSplit] > values[curIndex]) {
