Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs	(revision 5559)
@@ -125,5 +125,5 @@
       if (count == 0) count = 1;
       return RandomEnumerable.SampleRandomNumbers(seed, SamplesEnd.Value, SamplesStart.Value, count)
-        .Where(i => i < ProblemDataParameter.ActualValue.TestSamplesStart || ProblemDataParameter.ActualValue.TestSamplesEnd <= i);
+        .Where(i => i < ProblemDataParameter.ActualValue.TestPartitionStart || ProblemDataParameter.ActualValue.TestPartitionEnd <= i);
     }
   }
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblemData.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblemData.cs	(revision 5559)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblemData.cs	(revision 5559)
@@ -0,0 +1,307 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.DataAnalysis {
+  [StorableClass]
+  public class ClassificationProblemData : DataAnalysisProblemData, IClassificationProblemData {
+    #region default data
+    private static string[] defaultVariableNames = new string[] { "sample", "clump thickness", "cell size", "cell shape", "marginal adhesion", "epithelial cell size", "bare nuclei", "chromatin", "nucleoli", "mitoses", "class" };
+    private static double[,] defaultData = new double[,]{
+     {1000025,5,1,1,1,2,1,3,1,1,2      },
+     {1002945,5,4,4,5,7,10,3,2,1,2     },
+     {1015425,3,1,1,1,2,2,3,1,1,2      },
+     {1016277,6,8,8,1,3,4,3,7,1,2      },
+     {1017023,4,1,1,3,2,1,3,1,1,2      },
+     {1017122,8,10,10,8,7,10,9,7,1,4   },
+     {1018099,1,1,1,1,2,10,3,1,1,2     },
+     {1018561,2,1,2,1,2,1,3,1,1,2      },
+     {1033078,2,1,1,1,2,1,1,1,5,2      },
+     {1033078,4,2,1,1,2,1,2,1,1,2      },
+     {1035283,1,1,1,1,1,1,3,1,1,2      },
+     {1036172,2,1,1,1,2,1,2,1,1,2      },
+     {1041801,5,3,3,3,2,3,4,4,1,4      },
+     {1043999,1,1,1,1,2,3,3,1,1,2      },
+     {1044572,8,7,5,10,7,9,5,5,4,4     },
+     {1047630,7,4,6,4,6,1,4,3,1,4      },
+     {1048672,4,1,1,1,2,1,2,1,1,2      },
+     {1049815,4,1,1,1,2,1,3,1,1,2      },
+     {1050670,10,7,7,6,4,10,4,1,2,4    },
+     {1050718,6,1,1,1,2,1,3,1,1,2      },
+     {1054590,7,3,2,10,5,10,5,4,4,4    },
+     {1054593,10,5,5,3,6,7,7,10,1,4    },
+     {1056784,3,1,1,1,2,1,2,1,1,2      },
+     {1057013,8,4,5,1,2,2,7,3,1,4      },
+     {1059552,1,1,1,1,2,1,3,1,1,2      },
+     {1065726,5,2,3,4,2,7,3,6,1,4      },
+     {1066373,3,2,1,1,1,1,2,1,1,2      },
+     {1066979,5,1,1,1,2,1,2,1,1,2      },
+     {1067444,2,1,1,1,2,1,2,1,1,2      },
+     {1070935,1,1,3,1,2,1,1,1,1,2      },
+     {1070935,3,1,1,1,1,1,2,1,1,2      },
+     {1071760,2,1,1,1,2,1,3,1,1,2      },
+     {1072179,10,7,7,3,8,5,7,4,3,4     },
+     {1074610,2,1,1,2,2,1,3,1,1,2      },
+     {1075123,3,1,2,1,2,1,2,1,1,2      },
+     {1079304,2,1,1,1,2,1,2,1,1,2      },
+     {1080185,10,10,10,8,6,1,8,9,1,4   },
+     {1081791,6,2,1,1,1,1,7,1,1,2      },
+     {1084584,5,4,4,9,2,10,5,6,1,4     },
+     {1091262,2,5,3,3,6,7,7,5,1,4      },
+     {1096800,6,6,6,9,6,4,7,8,1,2      },
+     {1099510,10,4,3,1,3,3,6,5,2,4     },
+     {1100524,6,10,10,2,8,10,7,3,3,4   },
+     {1102573,5,6,5,6,10,1,3,1,1,4     },
+     {1103608,10,10,10,4,8,1,8,10,1,4  },
+     {1103722,1,1,1,1,2,1,2,1,2,2      },
+     {1105257,3,7,7,4,4,9,4,8,1,4      },
+     {1105524,1,1,1,1,2,1,2,1,1,2      },
+     {1106095,4,1,1,3,2,1,3,1,1,2      },
+     {1106829,7,8,7,2,4,8,3,8,2,4      },
+     {1108370,9,5,8,1,2,3,2,1,5,4      },
+     {1108449,5,3,3,4,2,4,3,4,1,4      },
+     {1110102,10,3,6,2,3,5,4,10,2,4    },
+     {1110503,5,5,5,8,10,8,7,3,7,4     },
+     {1110524,10,5,5,6,8,8,7,1,1,4     },
+     {1111249,10,6,6,3,4,5,3,6,1,4     },
+     {1112209,8,10,10,1,3,6,3,9,1,4    },
+     {1113038,8,2,4,1,5,1,5,4,4,4      },
+     {1113483,5,2,3,1,6,10,5,1,1,4     },
+     {1113906,9,5,5,2,2,2,5,1,1,4      },
+     {1115282,5,3,5,5,3,3,4,10,1,4     },
+     {1115293,1,1,1,1,2,2,2,1,1,2      },
+     {1116116,9,10,10,1,10,8,3,3,1,4   },
+     {1116132,6,3,4,1,5,2,3,9,1,4      },
+     {1116192,1,1,1,1,2,1,2,1,1,2      },
+     {1116998,10,4,2,1,3,2,4,3,10,4    },
+     {1117152,4,1,1,1,2,1,3,1,1,2      },
+     {1118039,5,3,4,1,8,10,4,9,1,4     },
+     {1120559,8,3,8,3,4,9,8,9,8,4      },
+     {1121732,1,1,1,1,2,1,3,2,1,2      },
+     {1121919,5,1,3,1,2,1,2,1,1,2      },
+     {1123061,6,10,2,8,10,2,7,8,10,4   },
+     {1124651,1,3,3,2,2,1,7,2,1,2      },
+     {1125035,9,4,5,10,6,10,4,8,1,4    },
+     {1126417,10,6,4,1,3,4,3,2,3,4     },
+     {1131294,1,1,2,1,2,2,4,2,1,2      },
+     {1132347,1,1,4,1,2,1,2,1,1,2      },
+     {1133041,5,3,1,2,2,1,2,1,1,2      },
+     {1133136,3,1,1,1,2,3,3,1,1,2      },
+     {1136142,2,1,1,1,3,1,2,1,1,2      },
+     {1137156,2,2,2,1,1,1,7,1,1,2      },
+     {1143978,4,1,1,2,2,1,2,1,1,2      },
+     {1143978,5,2,1,1,2,1,3,1,1,2      },
+     {1147044,3,1,1,1,2,2,7,1,1,2      },
+     {1147699,3,5,7,8,8,9,7,10,7,4     },
+     {1147748,5,10,6,1,10,4,4,10,10,4  },
+     {1148278,3,3,6,4,5,8,4,4,1,4      },
+     {1148873,3,6,6,6,5,10,6,8,3,4     },
+     {1152331,4,1,1,1,2,1,3,1,1,2      },
+     {1155546,2,1,1,2,3,1,2,1,1,2      },
+     {1156272,1,1,1,1,2,1,3,1,1,2      },
+     {1156948,3,1,1,2,2,1,1,1,1,2      },
+     {1157734,4,1,1,1,2,1,3,1,1,2      },
+     {1158247,1,1,1,1,2,1,2,1,1,2      },
+     {1160476,2,1,1,1,2,1,3,1,1,2      },
+     {1164066,1,1,1,1,2,1,3,1,1,2      },
+     {1165297,2,1,1,2,2,1,1,1,1,2      },
+     {1165790,5,1,1,1,2,1,3,1,1,2      },
+     {1165926,9,6,9,2,10,6,2,9,10,4    },
+     {1166630,7,5,6,10,5,10,7,9,4,4    },
+     {1166654,10,3,5,1,10,5,3,10,2,4   },
+     {1167439,2,3,4,4,2,5,2,5,1,4      },
+     {1167471,4,1,2,1,2,1,3,1,1,2      },
+     {1168359,8,2,3,1,6,3,7,1,1,4      },
+     {1168736,10,10,10,10,10,1,8,8,8,4 },
+     {1169049,7,3,4,4,3,3,3,2,7,4      },
+     {1170419,10,10,10,8,2,10,4,1,1,4  },
+     {1170420,1,6,8,10,8,10,5,7,1,4    },
+     {1171710,1,1,1,1,2,1,2,3,1,2      },
+     {1171710,6,5,4,4,3,9,7,8,3,4      },
+     {1171795,1,3,1,2,2,2,5,3,2,2      },
+     {1171845,8,6,4,3,5,9,3,1,1,4      },
+     {1172152,10,3,3,10,2,10,7,3,3,4   },
+     {1173216,10,10,10,3,10,8,8,1,1,4  },
+     {1173235,3,3,2,1,2,3,3,1,1,2      },
+     {1173347,1,1,1,1,2,5,1,1,1,2      },
+     {1173347,8,3,3,1,2,2,3,2,1,2      },
+     {1173509,4,5,5,10,4,10,7,5,8,4    },
+     {1173514,1,1,1,1,4,3,1,1,1,2      },
+     {1173681,3,2,1,1,2,2,3,1,1,2      },
+     {1174057,1,1,2,2,2,1,3,1,1,2      },
+     {1174057,4,2,1,1,2,2,3,1,1,2      },
+     {1174131,10,10,10,2,10,10,5,3,3,4 },
+     {1174428,5,3,5,1,8,10,5,3,1,4     },
+     {1175937,5,4,6,7,9,7,8,10,1,4     },
+     {1176406,1,1,1,1,2,1,2,1,1,2      },
+     {1176881,7,5,3,7,4,10,7,5,5,4        }
+};
+    private static Dataset defaultDataset;
+    private static IEnumerable<string> defaultAllowedInputVariables;
+    private static string defaultTargetVariable;
+    static ClassificationProblemData() {
+      defaultDataset = new Dataset(defaultVariableNames, defaultData);
+      defaultDataset.Name = "Wisconsin classification problem";
+      defaultDataset.Description = "subset from to ..";
+
+      defaultAllowedInputVariables = defaultVariableNames.Except(new List<string>() { "sample", "class" });
+      defaultTargetVariable = "class";
+    }
+    #endregion
+
+    #region propeties
+    [Storable]
+    private string targetVariable;
+    public string TargetVariable {
+      get { return targetVariable; }
+      set {
+        if (!Dataset.VariableNames.Contains(value))
+          throw new ArgumentException(string.Format("The target variable {0} is not present in the dataset", value));
+        if (targetVariable != value) {
+          targetVariable = value;
+
+          InitializeTargetVariableDependentMembers();
+          OnChanged();
+        }
+      }
+    }
+
+    private List<double> classValues;
+    [Storable]
+    public IEnumerable<double> ClassValues {
+      get { return classValues; }
+      private set { classValues = new List<double>(value); }
+    }
+
+    public int Classes {
+      get { return classValues.Count; }
+    }
+
+    private Dictionary<double, string> classValueClassNameMapping;
+    private Dictionary<string, double> classNameClassValueMapping;
+    [Storable(Name = "ClassNames")]
+    private IEnumerable<KeyValuePair<double, string>> classValueClassNameMappingStorable {
+      get { return classValueClassNameMapping; }
+      set {
+        classValueClassNameMapping = new Dictionary<double, string>();
+        foreach (var mapping in value)
+          classValueClassNameMapping[mapping.Key] = mapping.Value;
+
+        classNameClassValueMapping = classValueClassNameMapping.ToDictionary(x => x.Value, x => x.Key);
+      }
+    }
+    public IEnumerable<string> ClassNames {
+      get { return classValueClassNameMapping.Values; }
+    }
+
+    [Storable]
+    private Dictionary<Tuple<double, double>, double> misclassificationMatrix;
+    #endregion
+
+
+    [StorableConstructor]
+    protected ClassificationProblemData(bool deserializing) : base(deserializing) { }
+    protected ClassificationProblemData(ClassificationProblemData original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) { return new ClassificationProblemData(this, cloner); }
+
+    public ClassificationProblemData()
+      : this(defaultDataset, defaultAllowedInputVariables, defaultTargetVariable) {
+    }
+
+    public ClassificationProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable)
+      : base(dataset, allowedInputVariables) {
+      TargetVariable = targetVariable;
+
+      InitializeTargetVariableDependentMembers();
+    }
+
+    private void InitializeTargetVariableDependentMembers() {
+      classValues = Dataset.GetEnumeratedVariableValues(targetVariable).Distinct().ToList();
+      classValues.Sort();
+
+      classValueClassNameMapping = new Dictionary<double, string>();
+      foreach (double classValue in ClassValues) {
+        classValueClassNameMapping.Add(classValue, "Class " + classValue);
+      }
+      classNameClassValueMapping = classValueClassNameMapping.ToDictionary(x => x.Value, x => x.Key);
+      OnClassNamesChanged();
+
+      //set default misclassification matrix
+      misclassificationMatrix = new Dictionary<Tuple<double, double>, double>();
+      foreach (double classValue1 in ClassValues) {
+        foreach (double classValue2 in ClassValues) {
+          double penalty = 1.0;
+          if (classValue1 == classValue2) penalty = 0.0;
+          SetClassificationPenalty(classValue1, classValue1, penalty);
+        }
+      }
+      OnClassificationPenaltyChanged();
+    }
+
+    public string GetClassName(double classValue) {
+      return classValueClassNameMapping[classValue];
+    }
+    public double GetClassValue(string className) {
+      return classNameClassValueMapping[className];
+    }
+    public void SetClassName(double classValue, string className) {
+      if (!classValues.Contains(classValue)) throw new ArgumentException();
+      if (classValueClassNameMapping[classValue] != className) {
+        classValueClassNameMapping[classValue] = className;
+        classNameClassValueMapping = classValueClassNameMapping.ToDictionary(x => x.Value, x => x.Key);
+      }
+    }
+
+    public double GetClassificationPenalty(string correctClassName, string estimatedClassName) {
+      return GetClassificationPenalty(GetClassValue(correctClassName), GetClassValue(estimatedClassName));
+    }
+    public double GetClassificationPenalty(double correctClassValue, double estimatedClassValue) {
+      var key = Tuple.Create(correctClassValue, estimatedClassValue);
+      return misclassificationMatrix[key];
+    }
+    public void SetClassificationPenalty(string correctClassName, string estimatedClassName, double penalty) {
+      SetClassificationPenalty(GetClassValue(correctClassName), GetClassValue(estimatedClassName), penalty);
+    }
+    public void SetClassificationPenalty(double correctClassValue, double estimatedClassValue, double penalty) {
+      var key = Tuple.Create(correctClassValue, estimatedClassValue);
+      if (misclassificationMatrix[key] != penalty) {
+        misclassificationMatrix[key] = penalty;
+        OnClassificationPenaltyChanged();
+      }
+    }
+
+    public event EventHandler ClassNamesChanged;
+    protected virtual void OnClassNamesChanged() {
+      var handler = ClassNamesChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    public event EventHandler ClassificationPenaltyChanged;
+    protected virtual void OnClassificationPenaltyChanged() {
+      var handler = ClassificationPenaltyChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+  }
+}
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblemData.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblemData.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblemData.cs	(revision 5559)
@@ -23,78 +23,87 @@
 using System.Collections.Generic;
 using System.Linq;
-using HeuristicLab.Collections;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis {
   [StorableClass]
-  public abstract class DataAnalysisProblemData : ParameterizedNamedItem,
-    IDataAnalysisProblemData {
-    private const string DatasetParameterName = "Dataset";
-    private const string InputVariablesParameterName = "Input variables";
-    private const string TrainingSamplesStartParameterName = "Training partition start";
-    private const string TrainingSamplesEndParameterName = "Training partition end";
-    private const string TestSamplesStartParameterName = "Test partition start";
-    private const string TestSamplesEndParameterName = "Test partition end";
-
-    #region parameter properties
-    public IValueParameter<Dataset> DatasetParameter {
-      get { return (IValueParameter<Dataset>)Parameters[DatasetParameterName]; }
-    }
-    public IValueParameter<ICheckedItemList<StringValue>> InputVariablesParameter {
-      get { return (IValueParameter<ICheckedItemList<StringValue>>)Parameters[InputVariablesParameterName]; }
-    }
-    public IValueParameter<IntValue> TrainingSamplesStartParameter {
-      get { return (IValueParameter<IntValue>)Parameters[TrainingSamplesStartParameterName]; }
-    }
-    public IValueParameter<IntValue> TrainingSamplesEndParameter {
-      get { return (IValueParameter<IntValue>)Parameters[TrainingSamplesEndParameterName]; }
-    }
-    public IValueParameter<IntValue> TestSamplesStartParameter {
-      get { return (IValueParameter<IntValue>)Parameters[TestSamplesStartParameterName]; }
-    }
-    public IValueParameter<IntValue> TestSamplesEndParameter {
-      get { return (IValueParameter<IntValue>)Parameters[TestSamplesEndParameterName]; }
-    }
-    #endregion
-
+  public abstract class DataAnalysisProblemData : NamedItem, IDataAnalysisProblemData {
     #region propeties
+    [Storable]
+    private Dataset dataset;
     public Dataset Dataset {
-      get { return DatasetParameter.Value; }
-    }
-    public IEnumerable<string> AllowedInputVariables {
-      get { return InputVariablesParameter.Value.CheckedItems.Select(i => i.Value.Value); }
+      get { return dataset; }
     }
 
-    public int TrainingSamplesStart {
-      get { return TrainingSamplesStartParameter.Value.Value; }
-      set { TrainingSamplesStartParameter.Value.Value = value; }
-    }
-    public int TrainingSamplesEnd {
-      get { return TrainingSamplesEndParameter.Value.Value; }
-      set { TrainingSamplesEndParameter.Value.Value = value; }
+    [Storable]
+    private HashSet<string> allowedInputVariables;
+    public IEnumerable<string> AllowedInputVariables {
+      get { return allowedInputVariables; }
     }
 
-    public int TestSamplesStart {
-      get { return TestSamplesStartParameter.Value.Value; }
-      set { TestSamplesStartParameter.Value.Value = value; }
+    [Storable]
+    private int trainingPartitionStart;
+    public int TrainingPartitionStart {
+      get { return trainingPartitionStart; }
+      set {
+        if (0 < value || value > dataset.Rows)
+          throw new ArgumentException(string.Format("The training partition start must be between 0 and the number of rows of the dataset ({0})", dataset.Rows));
+        if (trainingPartitionStart != value) {
+          trainingPartitionStart = value;
+          OnChanged();
+        }
+      }
     }
-    public int TestSamplesEnd {
-      get { return TestSamplesEndParameter.Value.Value; }
-      set { TestSamplesEndParameter.Value.Value = value; }
+    [Storable]
+    private int trainingPartitionEnd;
+    public int TrainingPartitionEnd {
+      get { return trainingPartitionEnd; }
+      set {
+        if (0 < value || value > dataset.Rows)
+          throw new ArgumentException(string.Format("The training partition end must be between 0 and the number of rows of the dataset ({0})", dataset.Rows));
+        if (trainingPartitionEnd != value) {
+          trainingPartitionEnd = value;
+          OnChanged();
+        }
+      }
+    }
+
+    [Storable]
+    private int testPartitionStart;
+    public int TestPartitionStart {
+      get { return testPartitionStart; }
+      set {
+        if (0 < value || value > dataset.Rows)
+          throw new ArgumentException(string.Format("The test partition start must be between 0 and the number of rows of the dataset ({0})", dataset.Rows));
+        if (testPartitionStart != value) {
+          testPartitionStart = value;
+          OnChanged();
+        }
+      }
+    }
+    [Storable]
+    private int testPartitionEnd;
+    public int TestPartitionEnd {
+      get { return testPartitionEnd; }
+      set {
+        if (0 < value || value > dataset.Rows)
+          throw new ArgumentException(string.Format("The test partition end must be between 0 and the number of rows of the dataset ({0})", dataset.Rows));
+        if (testPartitionEnd != value) {
+          testPartitionEnd = value;
+          OnChanged();
+        }
+      }
     }
 
     public IEnumerable<int> TrainingIndizes {
       get {
-        return Enumerable.Range(TrainingSamplesStart, TrainingSamplesEnd - TrainingSamplesStart)
-                         .Where(i => i >= 0 && i < Dataset.Rows && (i < TestSamplesStart || TestSamplesEnd <= i));
+        return Enumerable.Range(TrainingPartitionStart, TrainingPartitionEnd - TrainingPartitionStart)
+                         .Where(i => i >= 0 && i < Dataset.Rows && (i < TestPartitionStart || TestPartitionEnd <= i));
       }
     }
     public IEnumerable<int> TestIndizes {
       get {
-        return Enumerable.Range(TestSamplesStart, TestSamplesEnd - TestSamplesStart)
+        return Enumerable.Range(TestPartitionStart, TestPartitionEnd - TestPartitionStart)
            .Where(i => i >= 0 && i < Dataset.Rows);
       }
@@ -102,76 +111,38 @@
     #endregion
 
-    protected DataAnalysisProblemData(DataAnalysisProblemData original, Cloner cloner)
-      : base(original, cloner) {
-      RegisterEventHandlers();
-    }
+    protected DataAnalysisProblemData(DataAnalysisProblemData original, Cloner cloner) : base(original, cloner) { }
     [StorableConstructor]
     protected DataAnalysisProblemData(bool deserializing) : base(deserializing) { }
+
     protected DataAnalysisProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables) {
+      if (dataset == null) throw new ArgumentNullException("The dataset must not be null.");
+      if (allowedInputVariables == null) throw new ArgumentNullException("The allowedInputVariables must not be null.");
+
       if (allowedInputVariables.Except(dataset.VariableNames).Any())
         throw new ArgumentException("All allowed input variables must be present in the dataset.");
 
-      ICheckedItemList<StringValue> inputVariableList = new CheckedItemList<StringValue>(dataset.VariableNames.Select(x => new StringValue(x))).AsReadOnly();
-      foreach (StringValue inputVariable in inputVariableList) {
-        inputVariableList.SetItemCheckedState(inputVariable, allowedInputVariables.Contains(inputVariable.Value));
-      }
-
-      Parameters.Add(new ValueParameter<Dataset>(DatasetParameterName, dataset));
-      Parameters.Add(new ValueParameter<ICheckedItemList<StringValue>>(InputVariablesParameterName, inputVariableList));
-      Parameters.Add(new ValueParameter<IntValue>(TrainingSamplesStartParameterName, new IntValue(0)));
-      Parameters.Add(new ValueParameter<IntValue>(TrainingSamplesEndParameterName, new IntValue(dataset.Rows)));
-      Parameters.Add(new ValueParameter<IntValue>(TestSamplesStartParameterName, new IntValue(dataset.Rows)));
-      Parameters.Add(new ValueParameter<IntValue>(TestSamplesEndParameterName, new IntValue(dataset.Rows)));
-
-      RegisterEventHandlers();
+      this.dataset = dataset;
+      allowedInputVariables = new HashSet<string>(allowedInputVariables);
+      trainingPartitionStart = 0;
+      trainingPartitionEnd = dataset.Rows / 2;
+      testPartitionStart = dataset.Rows / 2;
+      testPartitionEnd = dataset.Rows;
     }
 
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      RegisterEventHandlers();
+    public bool AddAllowedInputVariable(string inputVariable) {
+      if (!Dataset.VariableNames.Contains(inputVariable))
+        throw new ArgumentException("The allowed input variable must be present in the dataset.");
+      if (allowedInputVariables.Contains(inputVariable)) return false;
+
+      allowedInputVariables.Add(inputVariable);
+      return true;
     }
+    public bool RemoveAllowedInputVariable(string inputVariable) {
+      if (!Dataset.VariableNames.Contains(inputVariable))
+        throw new ArgumentException("The allowed input variable must be present in the dataset.");
+      if (!allowedInputVariables.Contains(inputVariable)) return false;
 
-    #region changed event propagation
-    private void RegisterEventHandlers() {
-      DatasetParameter.ValueChanged += new EventHandler(Dataset_Changed);
-      TrainingSamplesStartParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged);
-      TrainingSamplesEndParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged);
-      TestSamplesStartParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged);
-      TestSamplesEndParameter.ValueChanged += new EventHandler(PartitionParameter_ValueChanged);
-
-      InputVariablesParameter.ValueChanged += new EventHandler(InputVariablesParameter_ValueChanged);
-      RegisterInputVariablesParameterValueEventHandlers();
-
-      TrainingSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
-      TrainingSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
-      TestSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
-      TestSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
-    }
-    private void RegisterInputVariablesParameterValueEventHandlers() {
-      InputVariablesParameter.Value.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed);
-      InputVariablesParameter.Value.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed);
-      InputVariablesParameter.Value.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed);
-      InputVariablesParameter.Value.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed);
-      InputVariablesParameter.Value.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed);
-      InputVariablesParameter.Value.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_Changed);
-    }
-
-    private void PartitionParameter_ValueChanged(object sender, EventArgs e) {
-      IntValue value = (IntValue)sender;
-      value.ValueChanged += new EventHandler(Partitions_ValueChanged);
-      OnChanged();
-    }
-    private void InputVariablesParameter_ValueChanged(object sender, EventArgs e) {
-      RegisterInputVariablesParameterValueEventHandlers();
-    }
-
-    private void Partitions_ValueChanged(object sender, EventArgs e) {
-      OnChanged();
-    }
-    private void InputVariables_Changed(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> e) {
-      OnChanged();
-    }
-    private void Dataset_Changed(object sender, EventArgs e) {
-      OnChanged();
+      allowedInputVariables.Remove(inputVariable);
+      return true;
     }
 
@@ -181,5 +152,4 @@
       if (listeners != null) listeners(this, EventArgs.Empty);
     }
-    #endregion
   }
 }
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs	(revision 5559)
@@ -36,5 +36,5 @@
     private Dataset(Dataset original, Cloner cloner)
       : base(original, cloner) {
-      variableNames = original.variableNames;
+      variableNameToVariableIndexMapping = original.variableNameToVariableIndexMapping;
       data = original.data;
     }
@@ -54,16 +54,18 @@
 
 
-    private Dictionary<string, int> variableNames;
+    private Dictionary<string, int> variableNameToVariableIndexMapping;
+    private Dictionary<int, string> variableIndexToVariableNameMapping;
     [Storable]
     public IEnumerable<string> VariableNames {
-      get { return variableNames.Keys; }
+      get { return variableNameToVariableIndexMapping.Keys; }
       private set {
-        if (variableNames != null) throw new InvalidOperationException("VariableNames can only be set once.");
-        this.variableNames = new Dictionary<string, int>();
+        if (variableNameToVariableIndexMapping != null) throw new InvalidOperationException("VariableNames can only be set once.");
+        this.variableNameToVariableIndexMapping = new Dictionary<string, int>();
         int i = 0;
         foreach (string variableName in value) {
-          this.variableNames.Add(variableName, i);
+          this.variableNameToVariableIndexMapping.Add(variableName, i);
           i++;
         }
+        variableNameToVariableIndexMapping = variableIndexToVariableNameMapping.ToDictionary(x => x.Value, x => x.Key);
       }
     }
@@ -127,9 +129,14 @@
 
     public string GetVariableName(int variableIndex) {
-      return VariableNames.ElementAt(variableIndex);
+      try {
+        return variableIndexToVariableNameMapping[variableIndex];
+      }
+      catch (KeyNotFoundException ex) {
+        throw new ArgumentException("The variable index " + variableIndex + " was not found.", ex);
+      }
     }
     public int GetVariableIndex(string variableName) {
       try {
-        return variableNames[variableName];
+        return variableNameToVariableIndexMapping[variableName];
       }
       catch (KeyNotFoundException ex) {
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj	(revision 5559)
@@ -108,4 +108,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ClassificationProblemData.cs" />
     <Compile Include="RegressionProblemData.cs" />
     <Compile Include="DataAnalysisProblemData.cs" />
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblemData.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblemData.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblemData.cs	(revision 5559)
@@ -20,18 +20,24 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 namespace HeuristicLab.Problems.DataAnalysis {
   public interface IClassificationProblemData : IDataAnalysisProblemData {
-    string TargetVariable { get; }
-    int NumberOfClasses { get; }
-
+    string TargetVariable { get; set; }
     IEnumerable<string> ClassNames { get; }
     IEnumerable<double> ClassValues { get; }
+    int Classes { get; }
 
     string GetClassName(double classValue);
     double GetClassValue(string className);
+    void SetClassName(double classValue, string className);
 
     double GetClassificationPenalty(string correctClass, string estimatedClass);
     double GetClassificationPenalty(double correctClassValue, double estimatedClassValue);
+    void SetClassificationPenalty(string correctClassName, string estimatedClassName, double penalty);
+    void SetClassificationPenalty(double correctClassValue, double estimatedClassValue, double penalty);
+
+    event EventHandler ClassNamesChanged;
+    event EventHandler ClassificationPenaltyChanged;
   }
 }
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs	(revision 5559)
@@ -29,8 +29,11 @@
     IEnumerable<string> AllowedInputVariables { get; }
 
-    int TrainingSamplesStart { get; set; }
-    int TrainingSamplesEnd { get; set; }
-    int TestSamplesStart { get; set; }
-    int TestSamplesEnd { get; set; }
+    bool AddAllowedInputVariable(string inputVariable);
+    bool RemoveAllowedInputVariable(string inputVariable);
+
+    int TrainingPartitionStart { get; set; }
+    int TrainingPartitionEnd { get; set; }
+    int TestPartitionStart { get; set; }
+    int TestPartitionEnd { get; set; }
 
     IEnumerable<int> TrainingIndizes { get; }
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs	(revision 5559)
@@ -22,5 +22,5 @@
 namespace HeuristicLab.Problems.DataAnalysis {
   public interface IRegressionProblemData : IDataAnalysisProblemData {
-    string TargetVariable { get; }
+    string TargetVariable { get; set; }
   }
 }
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineCovarianceEvaluator.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineCovarianceEvaluator.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineCovarianceEvaluator.cs	(revision 5559)
@@ -74,5 +74,5 @@
       OnlineCovarianceEvaluator covarianceEvaluator = new OnlineCovarianceEvaluator();
 
-      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
+      while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) {
         double estimated = secondEnumerator.Current;
         double original = firstEnumerator.Current;
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs	(revision 5559)
@@ -76,5 +76,5 @@
       }
 
-      if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
+      if (secondEnumerator.MoveNext() && firstEnumerator.MoveNext()) {
         throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
       } else {
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanSquaredErrorEvaluator.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanSquaredErrorEvaluator.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanSquaredErrorEvaluator.cs	(revision 5559)
@@ -67,5 +67,5 @@
       OnlineMeanSquaredErrorEvaluator mseEvaluator = new OnlineMeanSquaredErrorEvaluator();
 
-      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
+      while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) {
         double estimated = secondEnumerator.Current;
         double original = firstEnumerator.Current;
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs	(revision 5559)
@@ -67,5 +67,5 @@
       OnlineNormalizedMeanSquaredErrorEvaluator normalizedMSEEvaluator = new OnlineNormalizedMeanSquaredErrorEvaluator();
 
-      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
+      while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) {
         double estimated = secondEnumerator.Current;
         double original = firstEnumerator.Current;
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlinePearsonsRSquaredEvaluator.cs	(revision 5559)
@@ -75,5 +75,5 @@
       OnlinePearsonsRSquaredEvaluator rSquaredEvaluator = new OnlinePearsonsRSquaredEvaluator();
 
-      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
+      while (firstEnumerator.MoveNext() && secondEnumerator.MoveNext()) {
         double estimated = secondEnumerator.Current;
         double original = firstEnumerator.Current;
Index: /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblemData.cs
===================================================================
--- /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblemData.cs	(revision 5558)
+++ /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblemData.cs	(revision 5559)
@@ -22,16 +22,12 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Problems.DataAnalysis {
   [StorableClass]
-  public sealed class RegressionProblemData : DataAnalysisProblemData,
-    IRegressionProblemData {
-    private const string TargetVariableParameterName = "Target variable";
+  public sealed class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData {
 
     #region default data
@@ -69,4 +65,6 @@
     static RegressionProblemData() {
       defaultDataset = new Dataset(new string[] { "y", "x" }, kozaF1);
+      defaultDataset.Name = "Fourth-order Polynomial Function Benchmark Dataset";
+      defaultDataset.Description = "f(x) = x^4 + x^3 + x^2 + x^1";
       defaultAllowedInputVariables = new List<string>() { "x" };
       defaultTargetVariable = "y";
@@ -74,12 +72,17 @@
     #endregion
 
-    #region parameter properties
-    public IValueParameter<StringValue> TargetVariableParameter {
-      get { return (IValueParameter<StringValue>)Parameters[TargetVariableParameterName]; }
-    }
-    #endregion
     #region propeties
+    [Storable]
+    private string targetVariable;
     public string TargetVariable {
-      get { return TargetVariableParameter.Value.Value; }
+      get { return targetVariable; }
+      set {
+        if (!Dataset.VariableNames.Contains(value))
+          throw new ArgumentException(string.Format("The target variable {0} is not present in the dataset", value));
+        if (targetVariable != value) {
+          targetVariable = value;
+          OnChanged();
+        }
+      }
     }
     #endregion
@@ -87,8 +90,5 @@
     [StorableConstructor]
     private RegressionProblemData(bool deserializing) : base(deserializing) { }
-    private RegressionProblemData(RegressionProblemData original, Cloner cloner)
-      : base(original, cloner) {
-      RegisterEventHandlers();
-    }
+    private RegressionProblemData(RegressionProblemData original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) { return new RegressionProblemData(this, cloner); }
 
@@ -99,41 +99,18 @@
     public RegressionProblemData(Dataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable)
       : base(dataset, allowedInputVariables) {
-      if (!dataset.VariableNames.Contains(targetVariable))
-        throw new ArgumentException("The target variable must be present in the dataset");
-
-      ConstrainedValueParameter<StringValue> targetVariableParameter = new ConstrainedValueParameter<StringValue>(TargetVariableParameterName);
-      foreach (var variableName in dataset.VariableNames) {
-        StringValue targetVariableValue = new StringValue(variableName);
-        targetVariableParameter.ValidValues.Add(targetVariableValue);
-        if (variableName == targetVariable)
-          targetVariableParameter.Value = targetVariableValue;
-      }
-
-      Parameters.Add(targetVariableParameter);
-      RegisterEventHandlers();
+      TargetVariable = targetVariable;
     }
 
+    public static RegressionProblemData ImportFromFile(string fileName) {
+      TableFileParser csvFileParser = new TableFileParser();
+      csvFileParser.Parse(fileName);
 
+      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
+      dataset.Name = Path.GetFileName(fileName);
 
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      RegisterEventHandlers();
+      RegressionProblemData problemData = new RegressionProblemData(dataset, dataset.VariableNames.Skip(1), dataset.VariableNames.First());
+      problemData.Name = "Data imported from " + Path.GetFileName(fileName);
+      return problemData;
     }
-
-    #region event propagation
-    private void RegisterEventHandlers() {
-      TargetVariableParameter.Value.ValueChanged += new EventHandler(TargetVariable_ValueChanged);
-      TargetVariableParameter.ValueChanged += new EventHandler(TargetVariableParameter_ValueChanged);
-    }
-
-    private void TargetVariableParameter_ValueChanged(object sender, EventArgs e) {
-      TargetVariableParameter.Value.ValueChanged += new EventHandler(TargetVariable_ValueChanged);
-      OnChanged();
-    }
-
-    private void TargetVariable_ValueChanged(object sender, EventArgs e) {
-      OnChanged();
-    }
-    #endregion
   }
 }
