Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs	(revision 10993)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs	(revision 10994)
@@ -35,11 +35,6 @@
   public abstract class PreprocessingData : NamedItem, IPreprocessingData {
 
-    protected double trainingToTestRatio;
-    public IntRange TrainingPartition {
-      get { return new IntRange(0, (int)(Rows * trainingToTestRatio)); }
-    }
-    public IntRange TestPartition {
-      get { return new IntRange((int)(Rows * trainingToTestRatio), Rows); }
-    }
+    public IntRange TrainingPartition { get; set; }
+    public IntRange TestPartition { get; set; }
 
     protected IList<ITransformation> transformations;
@@ -86,6 +81,9 @@
       variableValues = CopyVariableValues(original.variableValues);
       variableNames = new List<string>(original.variableNames);
-      trainingToTestRatio = original.trainingToTestRatio;
+      TrainingPartition = (IntRange)original.TrainingPartition.Clone(cloner);
+      TestPartition = (IntRange)original.TestPartition.Clone(cloner);
       transformations = new List<ITransformation>();
+
+      RegisterEventHandler();
     }
 
@@ -114,5 +112,24 @@
       }
 
-      trainingToTestRatio = (double)problemData.TrainingPartition.Size / Math.Max(problemData.Dataset.Rows, double.Epsilon);
+      TrainingPartition = new IntRange(problemData.TrainingPartition.Start, problemData.TrainingPartition.End);
+      TestPartition = new IntRange(problemData.TestPartition.Start, problemData.TestPartition.End);
+      
+      RegisterEventHandler();
+    }
+
+    private void RegisterEventHandler() {
+      Changed += (s, e) => {
+        switch (e.Type) {
+          case DataPreprocessingChangedEventType.DeleteRow:
+            CheckPartitionRanges();
+            break;
+          case DataPreprocessingChangedEventType.Any:
+            CheckPartitionRanges();
+            break;
+          case DataPreprocessingChangedEventType.Transformation:
+            CheckPartitionRanges();
+            break;
+        }
+      };
     }
 
@@ -125,4 +142,12 @@
     }
 
+    private void CheckPartitionRanges() {
+      int maxRowIndex = Math.Max(0, Rows - 1);
+      TrainingPartition.Start = Math.Min(TrainingPartition.Start, maxRowIndex);
+      TrainingPartition.End = Math.Min(TrainingPartition.End, maxRowIndex);
+      TestPartition.Start = Math.Min(TestPartition.Start, maxRowIndex);
+      TestPartition.End = Math.Min(TestPartition.End, maxRowIndex);
+    }
+
     protected IList<IList> CopyVariableValues(IList<IList> original) {
       var copy = new List<IList>(original);
Index: /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
===================================================================
--- /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs	(revision 10993)
+++ /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs	(revision 10994)
@@ -25,4 +25,5 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Problems.DataAnalysis;
 using HeuristicLab.Problems.DataAnalysis.Transformations;
@@ -37,5 +38,6 @@
       public IList<string> VariableNames { get; set; }
 
-      public double TrainingToTestRatio { get; set; }
+      public IntRange TrainingPartition { get; set; }
+      public IntRange TestPartition { get; set; }
       public IList<ITransformation> Transformations { get; set; }
       public DataPreprocessingChangedEventType ChangedType { get; set; }
@@ -66,5 +68,6 @@
         VariableValues = CopyVariableValues(variableValues),
         VariableNames = new List<string>(variableNames),
-        TrainingToTestRatio = trainingToTestRatio,
+        TrainingPartition = new IntRange(TrainingPartition.Start, TrainingPartition.End),
+        TestPartition = new IntRange(TestPartition.Start, TestPartition.End),
         Transformations = new List<ITransformation>(transformations),
         ChangedType = changedType,
@@ -235,5 +238,6 @@
         variableValues = previousSnapshot.VariableValues;
         variableNames = previousSnapshot.VariableNames;
-        trainingToTestRatio = previousSnapshot.TrainingToTestRatio;
+        TrainingPartition = previousSnapshot.TrainingPartition;
+        TestPartition = previousSnapshot.TestPartition;
         transformations = previousSnapshot.Transformations;
         undoHistory.Remove(previousSnapshot);
