Index: branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingDataManipulation.cs
===================================================================
--- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingDataManipulation.cs	(revision 10221)
+++ branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingDataManipulation.cs	(revision 10234)
@@ -59,12 +59,45 @@
                 if (index > 0 && index < countValues)
                 {
-                    double prev = preprocessingData.GetCell<double>(variableName, index - 1);
-                    double next = preprocessingData.GetCell<double>(variableName, index + 1);
+                    int prevIndex = indexOfPrevPresentValue(variableName, index);
+                    int nextIndex = indexOfNextPresentValue(variableName, index);
 
-                    double interpolated = (prev + next) / 2;
+                    // no neighbours found
+                    if (prevIndex < 0 && nextIndex >= countValues)
+                    {
+                        continue;
+                    }
+                    double prev = preprocessingData.GetCell<double>(variableName, prevIndex);
+                    double next = preprocessingData.GetCell<double>(variableName, nextIndex);
 
-                    preprocessingData.SetCell<double>(variableName, index, interpolated);
+                    int valuesToInterpolate = nextIndex - prevIndex;
+
+                    double interpolationStep = (prev + next) / valuesToInterpolate;
+
+                    for (int i = prevIndex; i < nextIndex; ++i) {
+                        double interpolated = prev + (interpolationStep * (i-prevIndex));
+                        preprocessingData.SetCell<double>(variableName, i, interpolated);
+                    }
                 }
             }
+        }
+
+        private int indexOfPrevPresentValue(string variableName, int start) {
+            int offset = start - 1;
+            while(offset >= 0 && preprocessingData.IsMissingValue(variableName, offset)){
+                offset--;
+            }
+
+            return offset;
+        }
+
+        private int indexOfNextPresentValue(string variableName, int start)
+        {
+            int offset = start + 1;
+            while (offset < preprocessingData.Rows && preprocessingData.IsMissingValue(variableName,  offset))
+            {
+                offset++;
+            }
+
+            return offset;
         }
 
@@ -96,5 +129,5 @@
             // process all given ranges - e.g. TrainingPartition, Trainingpartition
             foreach (IntRange range in ranges) { 
-                List<int> shuffledIndices = new List<int>();
+                List<Tuple<int, int>> shuffledIndices = new List<Tuple<int,int>>();
                
                 // generate random indices used for shuffeling each column
@@ -102,5 +135,5 @@
                 {
                     int rand = random.Next(range.Start, i);
-                    shuffledIndices[i] = rand;
+                    shuffledIndices.Add(new Tuple<int,int>(i,rand));
                 }
 
@@ -123,14 +156,15 @@
         }
 
-        public void reOrderToIndices<T>(string variableName, List<int> indices) {
+        public void reOrderToIndices<T>(string variableName, List<Tuple<int, int>> indices) {
             // process all columns equally
-            for (int i = 0; i < preprocessingData.Rows; i++)
+            foreach(Tuple<int, int> index in indices)
             {
-                int replaceIndex = indices[i];
+                int originalIndex = index.Item1;
+                int replaceIndex = index.Item2;
 
-                T tmp = preprocessingData.GetCell<T>(variableName, i);
+                T tmp = preprocessingData.GetCell<T>(variableName, originalIndex);
                 T replaceValue = preprocessingData.GetCell<T>(variableName, replaceIndex);
 
-                preprocessingData.SetCell<T>(variableName, i, replaceValue);
+                preprocessingData.SetCell<T>(variableName, originalIndex, replaceValue);
                 preprocessingData.SetCell<T>(variableName, replaceIndex, tmp);
             }
