Index: trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs	(revision 2161)
+++ trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs	(revision 2162)
@@ -69,7 +69,16 @@
     public double[] ScalingFactor {
       get { return scalingFactor; }
+      set {
+        if (value.Length != scalingFactor.Length)
+          throw new ArgumentException("Length of scaling factor array doesn't match number of variables");
+        scalingFactor = value;
+      }
     }
     public double[] ScalingOffset {
       get { return scalingOffset; }
+      set {
+        if (value.Length != scalingOffset.Length) 
+          throw new ArgumentException("Length of scaling offset array doesn't match number of variables");
+        scalingOffset = value; }
     }
 
Index: trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs	(revision 2161)
+++ trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs	(revision 2162)
@@ -27,4 +27,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.DataAnalysis;
+using System.Linq;
 
 namespace HeuristicLab.Modeling {
@@ -83,7 +84,4 @@
 
     public override IOperation Apply(IScope scope) {
-      AddVariableToScope("Dataset", scope);
-      AddVariableToScope("TargetVariable", scope);
-      AddVariableToScope("AllowedFeatures", scope);
       AddVariableToScope("TrainingSamplesStart", scope);
       AddVariableToScope("TrainingSamplesEnd", scope);
@@ -92,4 +90,17 @@
       AddVariableToScope("TestSamplesStart", scope);
       AddVariableToScope("TestSamplesEnd", scope);
+
+      Dataset operatorDataset = (Dataset)GetVariable("Dataset").Value;
+      int targetVariable = ((IntData)GetVariable("TargetVariable").Value).Data;
+      ItemList<IntData> operatorAllowedFeatures = (ItemList<IntData>)GetVariable("AllowedFeatures").Value;
+
+      Dataset scopeDataset = CreateNewDataset(operatorDataset, targetVariable, operatorAllowedFeatures);
+
+      ItemList<IntData> allowedFeatures = new ItemList<IntData>();
+      allowedFeatures.AddRange(Enumerable.Range(1, scopeDataset.Columns -1 ).Select(x=>new IntData(x)));
+
+      scope.AddVariable(new Variable("Dataset", scopeDataset));
+      scope.AddVariable(new Variable("AllowedFeatures", allowedFeatures));
+      scope.AddVariable(new Variable("TargetVariable", new IntData(0)));
 
       int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
@@ -110,4 +121,38 @@
     }
 
+    private Dataset CreateNewDataset(Dataset operatorDataset, int targetVariable, ItemList<IntData> operatorAllowedFeatures) {
+      int columns = (operatorAllowedFeatures.Count() + 1);
+      double[] values = new double[operatorDataset.Rows * columns];
+
+      for (int i = 0; i < values.Length; i++) {
+        int row = i / columns;
+        int column = i % columns;
+        if (column == 0) {
+          values[i] = operatorDataset.GetValue(row, targetVariable);
+        } else {
+          values[i] = operatorDataset.GetValue(row, operatorAllowedFeatures[column-1].Data);
+        }
+      }
+
+      Dataset ds = new Dataset();
+      ds.Columns = columns;
+      ds.Rows = operatorDataset.Rows;
+      ds.Name = operatorDataset.Name;
+      ds.Samples = values;
+      double[] scalingFactor = new double[columns];
+      double[] scalingOffset = new double[columns];
+      ds.SetVariableName(0, operatorDataset.GetVariableName(targetVariable));
+      scalingFactor[0] = operatorDataset.ScalingFactor[targetVariable];
+      scalingOffset[0] = operatorDataset.ScalingOffset[targetVariable];
+      for (int column = 1; column < columns; column++) {
+        ds.SetVariableName(column, operatorDataset.GetVariableName(operatorAllowedFeatures[column - 1].Data));
+        scalingFactor[column] = operatorDataset.ScalingFactor[operatorAllowedFeatures[column - 1].Data];
+        scalingOffset[column] = operatorDataset.ScalingOffset[operatorAllowedFeatures[column - 1].Data];
+      }
+      ds.ScalingOffset = scalingOffset;
+      ds.ScalingFactor = scalingFactor;
+      return ds;
+    }
+
     private void AddVariableToScope(string variableName, IScope scope) {
       scope.AddVariable(new Variable(variableName, (IItem)GetVariable(variableName).Value.Clone()));      
