Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs	(revision 8430)
@@ -0,0 +1,119 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "CovarianceLinear", Description = "Linear covariance function for Gaussian processes.")]
+  public class CovarianceLinear : Item, ICovarianceFunction {
+    private static readonly double[] emptyArray = new double[0];
+
+    [Storable]
+    private double[,] x;
+    [Storable]
+    private double[,] xt;
+
+    private double[,] k;
+    private bool symmetric;
+
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return 0;
+    }
+    [StorableConstructor]
+    protected CovarianceLinear(bool deserializing) : base(deserializing) { }
+    protected CovarianceLinear(CovarianceLinear original, Cloner cloner)
+      : base(original, cloner) {
+      if (original.x != null) {
+        this.x = new double[original.x.GetLength(0), original.x.GetLength(1)];
+        Array.Copy(original.x, this.x, x.Length);
+
+        this.xt = new double[original.xt.GetLength(0), original.xt.GetLength(1)];
+        Array.Copy(original.xt, this.xt, xt.Length);
+
+        this.k = new double[original.k.GetLength(0), original.k.GetLength(1)];
+        Array.Copy(original.k, this.k, k.Length);
+      }
+      this.symmetric = original.symmetric;
+    }
+    public CovarianceLinear()
+      : base() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovarianceLinear(this, cloner);
+    }
+
+    public void SetParameter(double[] hyp) {
+      if (hyp.Length > 0) throw new ArgumentException("No hyperparameters are allowed for the linear covariance function.");
+      k = null;
+    }
+
+    public void SetData(double[,] x) {
+      SetData(x, x);
+      this.symmetric = true;
+    }
+
+    public void SetData(double[,] x, double[,] xt) {
+      this.x = x;
+      this.xt = xt;
+      this.symmetric = false;
+
+      k = null;
+    }
+
+    public double GetCovariance(int i, int j) {
+      if (k == null) CalculateInnerProduct();
+      return k[i, j];
+    }
+
+    public double[] GetGradient(int i, int j) {
+      return emptyArray;
+    }
+
+
+    private void CalculateInnerProduct() {
+      if (x.GetLength(1) != xt.GetLength(1)) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      int cols = xt.GetLength(0);
+      k = new double[rows, cols];
+      if (symmetric) {
+        for (int i = 0; i < rows; i++) {
+          for (int j = i; j < cols; j++) {
+            k[i, j] = Util.ScalarProd(Util.GetRow(x, i),
+                                      Util.GetRow(x, j));
+            k[j, i] = k[i, j];
+          }
+        }
+      } else {
+        for (int i = 0; i < rows; i++) {
+          for (int j = 0; j < cols; j++) {
+            k[i, j] = Util.ScalarProd(Util.GetRow(x, i),
+                                      Util.GetRow(xt, j));
+          }
+        }
+      }
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceNNOne.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceNNOne.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceNNOne.cs	(revision 8430)
@@ -0,0 +1,128 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  public class CovarianceNNOne : ICovarianceFunction {
+    private double[,] x;
+    private double[,] xt;
+    private double sf2;
+    private double l2;
+    private double[,] S;
+    private double[] sx;
+    private double[] sz;
+    private double sxsx;
+    private double sxsz;
+
+    public int NumberOfParameters {
+      get { return 2; }
+    }
+
+    public void SetMatrix(double[,] x) {
+      SetMatrix(x, x);
+    }
+
+    public void SetMatrix(double[,] x, double[,] xt) {
+      this.x = x;
+      this.xt = xt;
+      S = null;
+      sx = null;
+      sz = null;
+    }
+
+    public void SetHyperparamter(double[] hyp) {
+      if (hyp.Length != 2) throw new ArgumentException();
+      this.l2 = Math.Exp(2 * hyp[0]);
+      this.sf2 = Math.Exp(2 * hyp[1]);
+      S = null;
+      sx = null;
+      sz = null;
+    }
+
+    public double GetCovariance(int i, int j) {
+      if (S == null) CalculateVectorProducts();
+      if (sx == null) CalculateSx();
+      bool symmetric = x == xt;
+      double k;
+      if (symmetric) {
+        k = S[i, j] / sxsx;
+      } else {
+        k = S[i, j] / sxsz;
+      }
+      return sf2 * Math.Asin(k);
+    }
+
+
+    public double[] GetDiagonalCovariances() {
+      if (x != xt) throw new InvalidOperationException();
+      if (sx == null) CalculateSx();
+      int rows = x.GetLength(0);
+      var k = new double[rows];
+      for (int i = 0; i < rows; i++) {
+        k[i] = sx[i] / (sx[i] + l2);
+        k[i] = sf2 * Math.Asin(k[i]);
+      }
+      return k;
+    }
+
+    public double[] GetDerivatives(int i, int j) {
+      double[] dhyp = new double[NumberOfParameters];
+      double[] vx = sx.Select(e => e / (l2 + e) / 2).ToArray();
+
+      double k;
+      double v;
+      if (x == xt) {
+        k = S[i, j] / sxsx;
+        v = vx[i] + vx[j];
+      } else {
+        double[] vz = sz.Select(e => e / (l2 + e) / 2).ToArray();
+        v = vx[i] + vz[j];
+        k = S[i, j] / sxsz;
+      }
+      dhyp[0] = -2 * sf2 * (k - k * v) / Math.Sqrt(1 - k * k);
+      dhyp[1] = 2.0 * sf2 * Math.Asin(k);
+      return dhyp;
+    }
+
+    private void CalculateSx() {
+      this.sx = new double[x.GetLength(0)];
+      for (int i = 0; i < sx.Length; i++) {
+        sx[i] = 1 + Product(GetRow(x, i), GetRow(x, i));
+      }
+      this.sz = new double[xt.GetLength(0)];
+      for (int i = 0; i < sz.Length; i++) {
+        sz[i] = 1 + Product(GetRow(xt, i), GetRow(xt, i));
+      }
+
+      sxsx = Product(sx.Select(e => Math.Sqrt(l2 + e)), sx.Select(e => Math.Sqrt(l2 + e)));
+      sxsz = Product(sx.Select(e => Math.Sqrt(l2 + e)), sz.Select(e => Math.Sqrt(l2 + e)));
+    }
+
+    private void CalculateVectorProducts() {
+      if (x.GetLength(1) != xt.GetLength(1)) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      int cols = xt.GetLength(0);
+      S = new double[rows, cols];
+      bool symmetric = x == xt;
+      for (int i = 0; i < rows; i++) {
+        for (int j = i; j < rows; j++) {
+          S[i, j] = 1 + Product(GetRow(x, i), GetRow(xt, j));
+          if (symmetric) {
+            S[j, i] = S[i, j];
+          } else {
+            S[j, i] = 1 + Product(GetRow(x, j), GetRow(xt, i));
+          }
+        }
+      }
+    }
+
+
+    private double Product(IEnumerable<double> x, IEnumerable<double> y) {
+      return x.Zip(y, (a, b) => a * b).Sum();
+    }
+    private static IEnumerable<double> GetRow(double[,] x, int r) {
+      int cols = x.GetLength(1);
+      return Enumerable.Range(0, cols).Select(c => x[r, c]);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs	(revision 8430)
@@ -0,0 +1,164 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "CovariancePeriodic", Description = "Periodic covariance function for Gaussian processes.")]
+  public class CovariancePeriodic : Item, ICovarianceFunction {
+    [Storable]
+    private double[,] x;
+    [Storable]
+    private double[,] xt;
+    [Storable]
+    private double sf2;
+    [Storable]
+    private double l;
+    [Storable]
+    private double p;
+
+    private bool symmetric;
+
+    private double[,] sd;
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return 3;
+    }
+    [StorableConstructor]
+    protected CovariancePeriodic(bool deserializing) : base(deserializing) { }
+    protected CovariancePeriodic(CovariancePeriodic original, Cloner cloner)
+      : base(original, cloner) {
+      if (original.x != null) {
+        x = new double[original.x.GetLength(0), original.x.GetLength(1)];
+        Array.Copy(original.x, x, x.Length);
+        xt = new double[original.xt.GetLength(0), original.xt.GetLength(1)];
+        Array.Copy(original.xt, xt, xt.Length);
+      }
+      sf2 = original.sf2;
+      l = original.l;
+      p = original.p;
+      symmetric = original.symmetric;
+    }
+    public CovariancePeriodic()
+      : base() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovariancePeriodic(this, cloner);
+    }
+
+    public void SetParameter(double[] hyp) {
+      if (hyp.Length != 3) throw new ArgumentException();
+      this.l = Math.Exp(hyp[0]);
+      this.p = Math.Exp(hyp[1]);
+      this.sf2 = Math.Exp(2 * hyp[2]);
+
+      sf2 = Math.Min(10E6, sf2); // upper limit for the scale
+
+      sd = null;
+    }
+    public void SetData(double[,] x) {
+      SetData(x, x);
+      this.symmetric = true;
+    }
+
+    public void SetData(double[,] x, double[,] xt) {
+      this.x = x;
+      this.xt = xt;
+      this.symmetric = false;
+
+      sd = null;
+    }
+
+    public double GetCovariance(int i, int j) {
+      if (sd == null) CalculateSquaredDistances();
+      double k = sd[i, j];
+      k = Math.PI * k / p;
+      k = Math.Sin(k) / l;
+      k = k * k;
+
+      return sf2 * Math.Exp(-2.0 * k);
+    }
+
+
+    public double[] GetDiagonalCovariances() {
+      if (x != xt) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      var cov = new double[rows];
+      for (int i = 0; i < rows; i++) {
+        double k = Math.Sqrt(Util.SqrDist(Util.GetRow(x, i), Util.GetRow(xt, i)));
+        k = Math.PI * k / p;
+        k = Math.Sin(k) / l;
+        k = k * k;
+        cov[i] = sf2 * Math.Exp(-2.0 * k);
+      }
+      return cov;
+    }
+
+    public double[] GetGradient(int i, int j) {
+
+      var res = new double[3];
+      double k = sd[i, j];
+      k = Math.PI * k / p;
+      {
+        double newK = Math.Sin(k) / l;
+        newK = newK * newK;
+        res[0] = 4 * sf2 * Math.Exp(-2 * newK) * newK;
+      }
+      {
+        double r = Math.Sin(k) / l;
+        res[1] = 4 * sf2 / l * Math.Exp(-2 * r * r) * r * Math.Cos(k) * k;
+      }
+      {
+        double newK = Math.Sin(k) / l;
+        newK = newK * newK;
+        res[2] = 2 * sf2 * Math.Exp(-2 * newK);
+      }
+
+      return res;
+    }
+
+    private void CalculateSquaredDistances() {
+      if (x.GetLength(1) != xt.GetLength(1)) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      int cols = xt.GetLength(0);
+      sd = new double[rows, cols];
+
+      if (symmetric) {
+        for (int i = 0; i < rows; i++) {
+          for (int j = i; j < cols; j++) {
+            sd[i, j] = Math.Sqrt(Util.SqrDist(Util.GetRow(x, i), Util.GetRow(x, j)));
+            sd[j, i] = sd[i, j];
+          }
+        }
+      } else {
+        for (int i = 0; i < rows; i++) {
+          for (int j = 0; j < cols; j++) {
+            sd[i, j] = Math.Sqrt(Util.SqrDist(Util.GetRow(x, i), Util.GetRow(xt, j)));
+          }
+        }
+      }
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs	(revision 8430)
@@ -0,0 +1,92 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "CovarianceProd",
+    Description = "Product covariance function for Gaussian processes.")]
+  public class CovarianceProd : Item, ICovarianceFunction {
+    [Storable]
+    private ItemList<ICovarianceFunction> factors;
+
+    [Storable]
+    private int numberOfVariables;
+    public ItemList<ICovarianceFunction> Factors {
+      get { return factors; }
+    }
+
+    [StorableConstructor]
+    protected CovarianceProd(bool deserializing)
+      : base(deserializing) {
+    }
+
+    protected CovarianceProd(CovarianceProd original, Cloner cloner)
+      : base(original, cloner) {
+      this.factors = cloner.Clone(original.factors);
+      this.numberOfVariables = original.numberOfVariables;
+    }
+
+    public CovarianceProd()
+      : base() {
+      this.factors = new ItemList<ICovarianceFunction>();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovarianceProd(this, cloner);
+    }
+
+    public int GetNumberOfParameters(int numberOfVariables) {
+      this.numberOfVariables = numberOfVariables;
+      return factors.Select(t => t.GetNumberOfParameters(numberOfVariables)).Sum();
+    }
+
+    public void SetParameter(double[] hyp) {
+      int offset = 0;
+      foreach (var t in factors) {
+        var numberOfParameters = t.GetNumberOfParameters(numberOfVariables);
+        t.SetParameter(hyp.Skip(offset).Take(numberOfParameters).ToArray());
+        offset += numberOfParameters;
+      }
+    }
+    public void SetData(double[,] x) {
+      SetData(x, x);
+    }
+
+    public void SetData(double[,] x, double[,] xt) {
+      foreach (var t in factors) {
+        t.SetData(x, xt);
+      }
+    }
+
+    public double GetCovariance(int i, int j) {
+      return factors.Select(t => t.GetCovariance(i, j)).Aggregate((a, b) => a * b);
+    }
+
+    public double[] GetGradient(int i, int j) {
+      return factors.Select(t => t.GetGradient(i, j)).SelectMany(seq => seq).ToArray();
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs	(revision 8430)
@@ -0,0 +1,136 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "CovarianceSEard", Description = "Squared exponential covariance function with automatic relevance determination for Gaussian processes.")]
+  public class CovarianceSEard : Item, ICovarianceFunction {
+    [Storable]
+    private double[,] x;
+    [Storable]
+    private double[,] xt;
+    [Storable]
+    private double sf2;
+    [Storable]
+    private double[] l;
+
+    private double[,] sd;
+    private bool symmetric;
+
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return numberOfVariables + 1;
+    }
+    [StorableConstructor]
+    protected CovarianceSEard(bool deserializing) : base(deserializing) { }
+    protected CovarianceSEard(CovarianceSEard original, Cloner cloner)
+      : base(original, cloner) {
+      if (original.x != null) {
+        this.x = new double[original.x.GetLength(0), original.x.GetLength(1)];
+        Array.Copy(original.x, this.x, x.Length);
+
+        this.xt = new double[original.xt.GetLength(0), original.xt.GetLength(1)];
+        Array.Copy(original.xt, this.xt, xt.Length);
+
+        this.sd = new double[original.sd.GetLength(0), original.sd.GetLength(1)];
+        Array.Copy(original.sd, this.sd, sd.Length);
+
+        this.l = new double[original.l.Length];
+        Array.Copy(original.l, this.l, l.Length);
+      }
+      this.sf2 = original.sf2;
+      this.symmetric = original.symmetric;
+    }
+    public CovarianceSEard()
+      : base() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovarianceSEard(this, cloner);
+    }
+
+    public void SetParameter(double[] hyp) {
+      this.l = hyp.Take(hyp.Length - 1).Select(Math.Exp).ToArray();
+      this.sf2 = Math.Exp(2 * hyp[hyp.Length - 1]);
+      sf2 = Math.Min(10E6, sf2); // upper limit for the scale
+
+      sd = null;
+    }
+
+    public void SetData(double[,] x) {
+      SetData(x, x);
+      this.symmetric = true;
+    }
+
+    public void SetData(double[,] x, double[,] xt) {
+      this.x = x;
+      this.xt = xt;
+      this.symmetric = false;
+
+      sd = null;
+    }
+
+    public double GetCovariance(int i, int j) {
+      if (sd == null) CalculateSquaredDistances();
+      return sf2 * Math.Exp(-sd[i, j] / 2.0);
+    }
+
+    public double[] GetGradient(int i, int j) {
+      var res = new double[l.Length + 1];
+      for (int k = 0; k < l.Length; k++) {
+        double sqrDist = Util.SqrDist(x[i, k] / l[k], xt[j, k] / l[k]);
+
+        res[k] = sf2 * Math.Exp(-sd[i, j] / 2.0) * sqrDist;
+      }
+      res[res.Length - 1] = 2.0 * sf2 * Math.Exp(-sd[i, j] / 2.0);
+      return res;
+    }
+
+
+    private void CalculateSquaredDistances() {
+      if (x.GetLength(1) != xt.GetLength(1)) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      int cols = xt.GetLength(0);
+      sd = new double[rows, cols];
+      if (symmetric) {
+        for (int i = 0; i < rows; i++) {
+          for (int j = i; j < cols; j++) {
+            sd[i, j] = Util.SqrDist(Util.GetRow(x, i).Select((e, k) => e / l[k]),
+                                    Util.GetRow(xt, j).Select((e, k) => e / l[k]));
+            sd[j, i] = sd[i, j];
+          }
+        }
+      } else {
+        for (int i = 0; i < rows; i++) {
+          for (int j = 0; j < cols; j++) {
+            sd[i, j] = Util.SqrDist(Util.GetRow(x, i).Select((e, k) => e / l[k]),
+                                    Util.GetRow(xt, j).Select((e, k) => e / l[k]));
+          }
+        }
+      }
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs	(revision 8430)
@@ -0,0 +1,131 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "CovarianceSEiso",
+    Description = "Isotropic squared exponential covariance function for Gaussian processes.")]
+  public class CovarianceSEiso : Item, ICovarianceFunction {
+    [Storable]
+    private double[,] x;
+    [Storable]
+    private double[,] xt;
+    [Storable]
+    private double sf2;
+    [Storable]
+    private double l;
+    [Storable]
+    private bool symmetric;
+    private double[,] sd;
+
+    [StorableConstructor]
+    protected CovarianceSEiso(bool deserializing)
+      : base(deserializing) {
+    }
+
+    protected CovarianceSEiso(CovarianceSEiso original, Cloner cloner)
+      : base(original, cloner) {
+      if (original.x != null) {
+        this.x = new double[original.x.GetLength(0), original.x.GetLength(1)];
+        Array.Copy(original.x, this.x, x.Length);
+
+        this.xt = new double[original.xt.GetLength(0), original.xt.GetLength(1)];
+        Array.Copy(original.xt, this.xt, xt.Length);
+
+        this.sd = new double[original.sd.GetLength(0), original.sd.GetLength(1)];
+        Array.Copy(original.sd, this.sd, sd.Length);
+        this.sf2 = original.sf2;
+      }
+      this.sf2 = original.sf2;
+      this.l = original.l;
+      this.symmetric = original.symmetric;
+    }
+
+    public CovarianceSEiso()
+      : base() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovarianceSEiso(this, cloner);
+    }
+
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return 2;
+    }
+
+    public void SetParameter(double[] hyp) {
+      this.l = Math.Exp(hyp[0]);
+      this.sf2 = Math.Min(1E6, Math.Exp(2 * hyp[1])); // upper limit for scale
+      sd = null;
+    }
+    public void SetData(double[,] x) {
+      SetData(x, x);
+      this.symmetric = true;
+    }
+
+
+    public void SetData(double[,] x, double[,] xt) {
+      this.symmetric = false;
+      this.x = x;
+      this.xt = xt;
+      sd = null;
+    }
+
+    public double GetCovariance(int i, int j) {
+      if (sd == null) CalculateSquaredDistances();
+      return sf2 * Math.Exp(-sd[i, j] / 2.0);
+    }
+
+    public double[] GetGradient(int i, int j) {
+      var res = new double[2];
+      res[0] = sf2 * Math.Exp(-sd[i, j] / 2.0) * sd[i, j];
+      res[1] = 2.0 * sf2 * Math.Exp(-sd[i, j] / 2.0);
+      return res;
+    }
+
+    private void CalculateSquaredDistances() {
+      if (x.GetLength(1) != xt.GetLength(1)) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      int cols = xt.GetLength(0);
+      sd = new double[rows, cols];
+      if (symmetric) {
+        for (int i = 0; i < rows; i++) {
+          for (int j = i; j < rows; j++) {
+            sd[i, j] = Util.SqrDist(Util.GetRow(x, i).Select(e => e / l), Util.GetRow(xt, j).Select(e => e / l));
+            sd[j, i] = sd[i, j];
+          }
+        }
+      } else {
+        for (int i = 0; i < rows; i++) {
+          for (int j = 0; j < cols; j++) {
+            sd[i, j] = Util.SqrDist(Util.GetRow(x, i).Select(e => e / l), Util.GetRow(xt, j).Select(e => e / l));
+          }
+        }
+      }
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSum.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSum.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSum.cs	(revision 8430)
@@ -0,0 +1,92 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "CovarianceSum",
+    Description = "Sum covariance function for Gaussian processes.")]
+  public class CovarianceSum : Item, ICovarianceFunction {
+    [Storable]
+    private ItemList<ICovarianceFunction> terms;
+
+    [Storable]
+    private int numberOfVariables;
+    public ItemList<ICovarianceFunction> Terms {
+      get { return terms; }
+    }
+
+    [StorableConstructor]
+    protected CovarianceSum(bool deserializing)
+      : base(deserializing) {
+    }
+
+    protected CovarianceSum(CovarianceSum original, Cloner cloner)
+      : base(original, cloner) {
+      this.terms = cloner.Clone(original.terms);
+      this.numberOfVariables = original.numberOfVariables;
+    }
+
+    public CovarianceSum()
+      : base() {
+      this.terms = new ItemList<ICovarianceFunction>();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovarianceSum(this, cloner);
+    }
+
+    public int GetNumberOfParameters(int numberOfVariables) {
+      this.numberOfVariables = numberOfVariables;
+      return terms.Select(t => t.GetNumberOfParameters(numberOfVariables)).Sum();
+    }
+
+    public void SetParameter(double[] hyp) {
+      int offset = 0;
+      foreach (var t in terms) {
+        var numberOfParameters = t.GetNumberOfParameters(numberOfVariables);
+        t.SetParameter(hyp.Skip(offset).Take(numberOfParameters).ToArray());
+        offset += numberOfParameters;
+      }
+    }
+    public void SetData(double[,] x) {
+      SetData(x, x);
+    }
+
+    public void SetData(double[,] x, double[,] xt) {
+      foreach (var t in terms) {
+        t.SetData(x, xt);
+      }
+    }
+
+    public double GetCovariance(int i, int j) {
+      return terms.Select(t => t.GetCovariance(i, j)).Sum();
+    }
+
+    public double[] GetGradient(int i, int j) {
+      return terms.Select(t => t.GetGradient(i, j)).SelectMany(seq => seq).ToArray();
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessHyperparameterInitializer.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessHyperparameterInitializer.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessHyperparameterInitializer.cs	(revision 8430)
@@ -0,0 +1,89 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "GaussianProcessHyperparameterInitializer",
+    Description = "Initializers the hyperparameter vector based on the mean function, covariance function, and number of allowed input variables.")]
+  public sealed class GaussianProcessHyperparameterInitializer : SingleSuccessorOperator {
+    private const string MeanFunctionParameterName = "MeanFunction";
+    private const string CovarianceFunctionParameterName = "CovarianceFunction";
+    private const string ProblemDataParameterName = "ProblemData";
+    private const string HyperparameterParameterName = "Hyperparameter";
+
+    #region Parameter Properties
+    // in
+    public ILookupParameter<IMeanFunction> MeanFunctionParameter {
+      get { return (ILookupParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
+    }
+    public ILookupParameter<ICovarianceFunction> CovarianceFunctionParameter {
+      get { return (ILookupParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
+    }
+    public ILookupParameter<IDataAnalysisProblemData> ProblemDataParameter {
+      get { return (ILookupParameter<IDataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    // out
+    public ILookupParameter<RealVector> HyperparameterParameter {
+      get { return (ILookupParameter<RealVector>)Parameters[HyperparameterParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    private IMeanFunction MeanFunction { get { return MeanFunctionParameter.ActualValue; } }
+    private ICovarianceFunction CovarianceFunction { get { return CovarianceFunctionParameter.ActualValue; } }
+    private IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    private GaussianProcessHyperparameterInitializer(bool deserializing) : base(deserializing) { }
+    private GaussianProcessHyperparameterInitializer(GaussianProcessHyperparameterInitializer original, Cloner cloner) : base(original, cloner) { }
+    public GaussianProcessHyperparameterInitializer()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The input data for the Gaussian process."));
+      // out
+      Parameters.Add(new LookupParameter<RealVector>(HyperparameterParameterName, "The initial hyperparameter vector for the Gaussian process model."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessHyperparameterInitializer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var inputVariablesCount = ProblemData.AllowedInputVariables.Count();
+      int l = 1 + MeanFunction.GetNumberOfParameters(inputVariablesCount) +
+              CovarianceFunction.GetNumberOfParameters(inputVariablesCount);
+      HyperparameterParameter.ActualValue = new RealVector(l);
+      return base.Apply();
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8430)
@@ -0,0 +1,264 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  /// <summary>
+  /// Represents a Gaussian process model.
+  /// </summary>
+  [StorableClass]
+  [Item("GaussianProcessModel", "Represents a Gaussian process posterior.")]
+  public sealed class GaussianProcessModel : NamedItem, IGaussianProcessModel {
+    [Storable]
+    private double negativeLogLikelihood;
+    public double NegativeLogLikelihood {
+      get { return negativeLogLikelihood; }
+    }
+
+    [Storable]
+    private ICovarianceFunction covarianceFunction;
+    public ICovarianceFunction CovarianceFunction {
+      get { return covarianceFunction; }
+    }
+    [Storable]
+    private IMeanFunction meanFunction;
+    public IMeanFunction MeanFunction {
+      get { return meanFunction; }
+    }
+    [Storable]
+    private string targetVariable;
+    public string TargetVariable {
+      get { return targetVariable; }
+    }
+    [Storable]
+    private string[] allowedInputVariables;
+    public string[] AllowedInputVariables {
+      get { return allowedInputVariables; }
+    }
+
+    [Storable]
+    private double[] alpha;
+    [Storable]
+    private double sqrSigmaNoise;
+
+    [Storable]
+    private double[,] l;
+
+    [Storable]
+    private double[,] x;
+    [Storable]
+    private Scaling scaling;
+
+
+    [StorableConstructor]
+    private GaussianProcessModel(bool deserializing) : base(deserializing) { }
+    private GaussianProcessModel(GaussianProcessModel original, Cloner cloner)
+      : base(original, cloner) {
+      this.meanFunction = cloner.Clone(original.meanFunction);
+      this.covarianceFunction = cloner.Clone(original.covarianceFunction);
+      this.scaling = cloner.Clone(original.scaling);
+      this.negativeLogLikelihood = original.negativeLogLikelihood;
+      this.targetVariable = original.targetVariable;
+      this.sqrSigmaNoise = original.sqrSigmaNoise;
+
+      // shallow copies of arrays because they cannot be modified
+      this.allowedInputVariables = original.allowedInputVariables;
+      this.alpha = original.alpha;
+      this.l = original.l;
+      this.x = original.x;
+    }
+    public GaussianProcessModel(Dataset ds, string targetVariable, IEnumerable<string> allowedInputVariables, IEnumerable<int> rows,
+      IEnumerable<double> hyp, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction)
+      : base() {
+      this.name = ItemName;
+      this.description = ItemDescription;
+      this.meanFunction = (IMeanFunction)meanFunction.Clone();
+      this.covarianceFunction = (ICovarianceFunction)covarianceFunction.Clone();
+      this.targetVariable = targetVariable;
+      this.allowedInputVariables = allowedInputVariables.ToArray();
+
+      sqrSigmaNoise = Math.Exp(2.0 * hyp.First());
+      sqrSigmaNoise = Math.Max(10E-6, sqrSigmaNoise); // lower limit for the noise level
+
+      int nVariables = this.allowedInputVariables.Length;
+      this.meanFunction.SetParameter(hyp.Skip(1)
+        .Take(this.meanFunction.GetNumberOfParameters(nVariables))
+        .ToArray());
+      this.covarianceFunction.SetParameter(hyp.Skip(1 + this.meanFunction.GetNumberOfParameters(nVariables))
+        .Take(this.covarianceFunction.GetNumberOfParameters(nVariables))
+        .ToArray());
+
+      CalculateModel(ds, rows);
+    }
+
+    private void CalculateModel(Dataset ds, IEnumerable<int> rows) {
+      scaling = new Scaling(ds, allowedInputVariables, rows);
+      x = AlglibUtil.PrepareAndScaleInputMatrix(ds, allowedInputVariables, rows, scaling);
+
+      var y = ds.GetDoubleValues(targetVariable, rows).ToArray();
+
+      int n = x.GetLength(0);
+      l = new double[n, n];
+
+      meanFunction.SetData(x);
+      covarianceFunction.SetData(x);
+
+      // calculate means and covariances
+      double[] m = meanFunction.GetMean(x);
+      for (int i = 0; i < n; i++) {
+
+        for (int j = i; j < n; j++) {
+          l[j, i] = covarianceFunction.GetCovariance(i, j) / sqrSigmaNoise;
+          if (j == i) l[j, i] += 1.0;
+        }
+      }
+
+      // cholesky decomposition
+      int info;
+      alglib.densesolverreport denseSolveRep;
+
+      var res = alglib.trfac.spdmatrixcholesky(ref l, n, false);
+      if (!res) throw new InvalidOperationException("Matrix is not positive semidefinite");
+
+      // calculate sum of diagonal elements for likelihood
+      double diagSum = Enumerable.Range(0, n).Select(i => Math.Log(l[i, i])).Sum();
+
+      // solve for alpha
+      double[] ym = y.Zip(m, (a, b) => a - b).ToArray();
+
+      alglib.spdmatrixcholeskysolve(l, n, false, ym, out info, out denseSolveRep, out alpha);
+      for (int i = 0; i < alpha.Length; i++)
+        alpha[i] = alpha[i] / sqrSigmaNoise;
+      negativeLogLikelihood = 0.5 * Util.ScalarProd(ym, alpha) + diagSum + (n / 2.0) * Math.Log(2.0 * Math.PI * sqrSigmaNoise);
+    }
+
+    public double[] GetHyperparameterGradients() {
+      // derivatives
+      int n = x.GetLength(0);
+      int nAllowedVariables = x.GetLength(1);
+      double[,] q = new double[n, n];
+      double[,] eye = new double[n, n];
+      for (int i = 0; i < n; i++) eye[i, i] = 1.0;
+
+      int info;
+      alglib.densesolverreport denseSolveRep;
+
+      alglib.spdmatrixcholeskysolvem(l, n, false, eye, n, out info, out denseSolveRep, out q);
+      // double[,] a2 = outerProd(alpha, alpha);
+      for (int i = 0; i < n; i++) {
+        for (int j = 0; j < n; j++)
+          q[i, j] = q[i, j] / sqrSigmaNoise - alpha[i] * alpha[j]; // a2[i, j];
+      }
+
+      double noiseGradient = sqrSigmaNoise * Enumerable.Range(0, n).Select(i => q[i, i]).Sum();
+
+      double[] meanGradients = new double[meanFunction.GetNumberOfParameters(nAllowedVariables)];
+      for (int i = 0; i < meanGradients.Length; i++) {
+        var meanGrad = meanFunction.GetGradients(i, x);
+        meanGradients[i] = -Util.ScalarProd(meanGrad, alpha);
+      }
+
+      double[] covGradients = new double[covarianceFunction.GetNumberOfParameters(nAllowedVariables)];
+      if (covGradients.Length > 0) {
+        for (int i = 0; i < n; i++) {
+          for (int j = 0; j < n; j++) {
+            var covDeriv = covarianceFunction.GetGradient(i, j);
+            for (int k = 0; k < covGradients.Length; k++) {
+              covGradients[k] += q[i, j] * covDeriv[k];
+            }
+          }
+        }
+        covGradients = covGradients.Select(g => g / 2.0).ToArray();
+      }
+
+      return new double[] { noiseGradient }
+        .Concat(meanGradients)
+        .Concat(covGradients).ToArray();
+    }
+
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessModel(this, cloner);
+    }
+
+    #region IRegressionModel Members
+    public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
+      return GetEstimatedValuesHelper(dataset, rows);
+    }
+    public GaussianProcessRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
+      return new GaussianProcessRegressionSolution(this, problemData);
+    }
+    IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {
+      return CreateRegressionSolution(problemData);
+    }
+    #endregion
+
+    private IEnumerable<double> GetEstimatedValuesHelper(Dataset dataset, IEnumerable<int> rows) {
+      var newX = AlglibUtil.PrepareAndScaleInputMatrix(dataset, allowedInputVariables, rows, scaling);
+      int newN = newX.GetLength(0);
+      int n = x.GetLength(0);
+      // var predMean = new double[newN];
+      // predVar = new double[newN];
+
+
+
+      // var kss = new double[newN];
+      var Ks = new double[newN, n];
+      double[,] sWKs = new double[n, newN];
+      // double[,] v;
+
+
+      // for stddev 
+      //covarianceFunction.SetParameter(covHyp, newX);
+      //kss = covarianceFunction.GetDiagonalCovariances();
+
+      covarianceFunction.SetData(x, newX);
+      meanFunction.SetData(newX);
+      var ms = meanFunction.GetMean(newX);
+      for (int i = 0; i < newN; i++) {
+
+        for (int j = 0; j < n; j++) {
+          Ks[i, j] = covarianceFunction.GetCovariance(j, i);
+          sWKs[j, i] = Ks[i, j] / Math.Sqrt(sqrSigmaNoise);
+        }
+      }
+
+      // for stddev 
+      // alglib.rmatrixsolvem(l, n, sWKs, newN, true, out info, out denseSolveRep, out v);
+
+
+      for (int i = 0; i < newN; i++) {
+        // predMean[i] = ms[i] + prod(GetRow(Ks, i), alpha);
+        yield return ms[i] + Util.ScalarProd(Util.GetRow(Ks, i), alpha);
+        // var sumV2 = prod(GetCol(v, i), GetCol(v, i));
+        // predVar[i] = kss[i] - sumV2;
+      }
+
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModelCreator.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModelCreator.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModelCreator.cs	(revision 8430)
@@ -0,0 +1,86 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  // base class for GaussianProcessModelCreators (specific for classification and regression)
+  public abstract class GaussianProcessModelCreator : SingleSuccessorOperator {
+    private const string HyperparameterParameterName = "Hyperparameter";
+    private const string MeanFunctionParameterName = "MeanFunction";
+    private const string CovarianceFunctionParameterName = "CovarianceFunction";
+    private const string ModelParameterName = "Model";
+    private const string NegativeLogLikelihoodParameterName = "NegativeLogLikelihood";
+    private const string HyperparameterGradientsParameterName = "HyperparameterGradients";
+
+    #region Parameter Properties
+    // in
+    public ILookupParameter<RealVector> HyperparameterParameter {
+      get { return (ILookupParameter<RealVector>)Parameters[HyperparameterParameterName]; }
+    }
+    public ILookupParameter<IMeanFunction> MeanFunctionParameter {
+      get { return (ILookupParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
+    }
+    public ILookupParameter<ICovarianceFunction> CovarianceFunctionParameter {
+      get { return (ILookupParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
+    }
+    // out
+    public ILookupParameter<IGaussianProcessModel> ModelParameter {
+      get { return (ILookupParameter<IGaussianProcessModel>)Parameters[ModelParameterName]; }
+    }
+    public ILookupParameter<RealVector> HyperparameterGradientsParameter {
+      get { return (ILookupParameter<RealVector>)Parameters[HyperparameterGradientsParameterName]; }
+    }
+    public ILookupParameter<DoubleValue> NegativeLogLikelihoodParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters[NegativeLogLikelihoodParameterName]; }
+    }
+
+    #endregion
+
+    #region Properties
+    protected RealVector Hyperparameter { get { return HyperparameterParameter.ActualValue; } }
+    protected IMeanFunction MeanFunction { get { return MeanFunctionParameter.ActualValue; } }
+    protected ICovarianceFunction CovarianceFunction { get { return CovarianceFunctionParameter.ActualValue; } }
+    #endregion
+
+    [StorableConstructor]
+    protected GaussianProcessModelCreator(bool deserializing) : base(deserializing) { }
+    protected GaussianProcessModelCreator(GaussianProcessModelCreator original, Cloner cloner) : base(original, cloner) { }
+    protected GaussianProcessModelCreator()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<RealVector>(HyperparameterParameterName, "The hyperparameters for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function for the Gaussian process model."));
+      Parameters.Add(new LookupParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function for the Gaussian process model."));
+      // out
+      Parameters.Add(new LookupParameter<IGaussianProcessModel>(ModelParameterName, "The resulting Gaussian process model"));
+      Parameters.Add(new LookupParameter<RealVector>(HyperparameterGradientsParameterName, "The gradients of the hyperparameters for the produced Gaussian process model (necessary for hyperparameter optimization)"));
+      Parameters.Add(new LookupParameter<DoubleValue>(NegativeLogLikelihoodParameterName, "The negative log-likelihood of the produced Gaussian process model given the data."));
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 8430)
@@ -0,0 +1,183 @@
+
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Algorithms.GradientDescent;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  /// <summary>
+  ///Gaussian process regression data analysis algorithm.
+  /// </summary>
+  [Item("Gaussian Process Regression", "Gaussian process regression data analysis algorithm.")]
+  [Creatable("Data Analysis")]
+  [StorableClass]
+  public sealed class GaussianProcessRegression : EngineAlgorithm, IStorableContent {
+    public string Filename { get; set; }
+
+    public override Type ProblemType { get { return typeof(IRegressionProblem); } }
+    public new IRegressionProblem Problem {
+      get { return (IRegressionProblem)base.Problem; }
+      set { base.Problem = value; }
+    }
+
+    private const string MeanFunctionParameterName = "MeanFunction";
+    private const string CovarianceFunctionParameterName = "CovarianceFunction";
+    private const string MinimizationIterationsParameterName = "Iterations";
+    private const string ApproximateGradientsParameterName = "ApproximateGradients";
+
+    #region parameter properties
+    public IConstrainedValueParameter<IMeanFunction> MeanFunctionParameter {
+      get { return (IConstrainedValueParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
+    }
+    public IConstrainedValueParameter<ICovarianceFunction> CovarianceFunctionParameter {
+      get { return (IConstrainedValueParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
+    }
+    public IValueParameter<IntValue> MinimizationIterationsParameter {
+      get { return (IValueParameter<IntValue>)Parameters[MinimizationIterationsParameterName]; }
+    }
+    #endregion
+    #region properties
+    public IMeanFunction MeanFunction {
+      set { MeanFunctionParameter.Value = value; }
+      get { return MeanFunctionParameter.Value; }
+    }
+    public ICovarianceFunction CovarianceFunction {
+      set { CovarianceFunctionParameter.Value = value; }
+      get { return CovarianceFunctionParameter.Value; }
+    }
+    public int MinimizationIterations {
+      set { MinimizationIterationsParameter.Value.Value = value; }
+      get { return MinimizationIterationsParameter.Value.Value; }
+    }
+    #endregion
+    [StorableConstructor]
+    private GaussianProcessRegression(bool deserializing) : base(deserializing) { }
+    private GaussianProcessRegression(GaussianProcessRegression original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public GaussianProcessRegression()
+      : base() {
+      this.name = ItemName;
+      this.description = ItemDescription;
+
+      Problem = new RegressionProblem();
+
+      List<IMeanFunction> meanFunctions = ApplicationManager.Manager.GetInstances<IMeanFunction>().ToList();
+      List<ICovarianceFunction> covFunctions = ApplicationManager.Manager.GetInstances<ICovarianceFunction>().ToList();
+
+      Parameters.Add(new ConstrainedValueParameter<IMeanFunction>(MeanFunctionParameterName, "The mean function to use.",
+        new ItemSet<IMeanFunction>(meanFunctions), meanFunctions.First()));
+      Parameters.Add(new ConstrainedValueParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function to use.",
+        new ItemSet<ICovarianceFunction>(covFunctions), covFunctions.First()));
+      Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization with LM-BFGS.", new IntValue(20)));
+      Parameters.Add(new ValueParameter<BoolValue>(ApproximateGradientsParameterName, "Indicates that gradients should not be approximated (necessary for LM-BFGS).", new BoolValue(false)));
+      Parameters[ApproximateGradientsParameterName].Hidden = true; // should not be changed
+
+      var gpInitializer = new GaussianProcessHyperparameterInitializer();
+      var bfgsInitializer = new LbfgsInitializer();
+      var makeStep = new LbfgsMakeStep();
+      var branch = new ConditionalBranch();
+      var modelCreator = new GaussianProcessRegressionModelCreator();
+      var updateResults = new LbfgsUpdateResults();
+      var analyzer = new LbfgsAnalyzer();
+      var finalModelCreator = new GaussianProcessRegressionModelCreator();
+      var finalAnalyzer = new LbfgsAnalyzer();
+      var solutionCreator = new GaussianProcessRegressionSolutionCreator();
+
+      OperatorGraph.InitialOperator = gpInitializer;
+
+      gpInitializer.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
+      gpInitializer.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
+      gpInitializer.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
+      gpInitializer.HyperparameterParameter.ActualName = modelCreator.HyperparameterParameter.Name;
+      gpInitializer.Successor = bfgsInitializer;
+
+      bfgsInitializer.IterationsParameter.ActualName = MinimizationIterationsParameterName;
+      bfgsInitializer.PointParameter.ActualName = modelCreator.HyperparameterParameter.Name;
+      bfgsInitializer.ApproximateGradientsParameter.ActualName = ApproximateGradientsParameterName;
+      bfgsInitializer.Successor = makeStep;
+
+      makeStep.StateParameter.ActualName = bfgsInitializer.StateParameter.Name;
+      makeStep.PointParameter.ActualName = modelCreator.HyperparameterParameter.Name;
+      makeStep.Successor = branch;
+
+      branch.ConditionParameter.ActualName = makeStep.TerminationCriterionParameter.Name;
+      branch.FalseBranch = modelCreator;
+      branch.TrueBranch = finalModelCreator;
+
+      modelCreator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
+      modelCreator.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
+      modelCreator.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
+      modelCreator.Successor = updateResults;
+
+      updateResults.StateParameter.ActualName = bfgsInitializer.StateParameter.Name;
+      updateResults.QualityParameter.ActualName = modelCreator.NegativeLogLikelihoodParameter.Name;
+      updateResults.QualityGradientsParameter.ActualName = modelCreator.HyperparameterGradientsParameter.Name;
+      updateResults.ApproximateGradientsParameter.ActualName = ApproximateGradientsParameterName;
+      updateResults.Successor = analyzer;
+
+      analyzer.QualityParameter.ActualName = modelCreator.NegativeLogLikelihoodParameter.Name;
+      analyzer.PointParameter.ActualName = modelCreator.HyperparameterParameter.Name;
+      analyzer.QualityGradientsParameter.ActualName = modelCreator.HyperparameterGradientsParameter.Name;
+      analyzer.StateParameter.ActualName = bfgsInitializer.StateParameter.Name;
+      analyzer.PointsTableParameter.ActualName = "Hyperparameter table";
+      analyzer.QualityGradientsTableParameter.ActualName = "Gradients table";
+      analyzer.QualitiesTableParameter.ActualName = "Negative log likelihood table";
+      analyzer.Successor = makeStep;
+
+      finalModelCreator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
+      finalModelCreator.MeanFunctionParameter.ActualName = MeanFunctionParameterName;
+      finalModelCreator.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName;
+      finalModelCreator.HyperparameterParameter.ActualName = bfgsInitializer.PointParameter.ActualName;
+      finalModelCreator.Successor = finalAnalyzer;
+
+      finalAnalyzer.QualityParameter.ActualName = modelCreator.NegativeLogLikelihoodParameter.Name;
+      finalAnalyzer.PointParameter.ActualName = modelCreator.HyperparameterParameter.Name;
+      finalAnalyzer.QualityGradientsParameter.ActualName = modelCreator.HyperparameterGradientsParameter.Name;
+      finalAnalyzer.PointsTableParameter.ActualName = analyzer.PointsTableParameter.ActualName;
+      finalAnalyzer.QualityGradientsTableParameter.ActualName = analyzer.QualityGradientsTableParameter.ActualName;
+      finalAnalyzer.QualitiesTableParameter.ActualName = analyzer.QualitiesTableParameter.ActualName;
+      finalAnalyzer.Successor = solutionCreator;
+
+      solutionCreator.ModelParameter.ActualName = finalModelCreator.ModelParameter.Name;
+      solutionCreator.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name;
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessRegression(this, cloner);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionModelCreator.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionModelCreator.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionModelCreator.cs	(revision 8430)
@@ -0,0 +1,73 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "GaussianProcessRegressionModelCreator",
+    Description = "Creates a Gaussian process model for regression given the data, the hyperparameters, a mean function, and a covariance function.")]
+  public sealed class GaussianProcessRegressionModelCreator : GaussianProcessModelCreator {
+    private const string ProblemDataParameterName = "ProblemData";
+
+    #region Parameter Properties
+    public ILookupParameter<IRegressionProblemData> ProblemDataParameter {
+      get { return (ILookupParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    #endregion
+
+    #region Properties
+    private IRegressionProblemData ProblemData {
+      get { return ProblemDataParameter.ActualValue; }
+    }
+    #endregion
+    [StorableConstructor]
+    private GaussianProcessRegressionModelCreator(bool deserializing) : base(deserializing) { }
+    private GaussianProcessRegressionModelCreator(GaussianProcessRegressionModelCreator original, Cloner cloner) : base(original, cloner) { }
+    public GaussianProcessRegressionModelCreator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The regression problem data for the Gaussian process model."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessRegressionModelCreator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var model = Create(ProblemData, Hyperparameter.ToArray(), MeanFunction, CovarianceFunction);
+      ModelParameter.ActualValue = model;
+      NegativeLogLikelihoodParameter.ActualValue = new DoubleValue(model.NegativeLogLikelihood);
+      HyperparameterGradientsParameter.ActualValue = new RealVector(model.GetHyperparameterGradients());
+      return base.Apply();
+    }
+
+    public static IGaussianProcessModel Create(IRegressionProblemData problemData, double[] hyperparameter, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction) {
+      return new GaussianProcessModel(problemData.Dataset, problemData.TargetVariable, problemData.AllowedInputVariables, problemData.TrainingIndices, hyperparameter, meanFunction, covarianceFunction);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs	(revision 8430)
@@ -0,0 +1,54 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  /// <summary>
+  /// Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.
+  /// </summary>
+  [Item("GaussianProcessRegressionSolution", "Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.")]
+  [StorableClass]
+  public sealed class GaussianProcessRegressionSolution : RegressionSolution, IGaussianProcessSolution {
+
+    public new IGaussianProcessModel Model {
+      get { return (IGaussianProcessModel)base.Model; }
+      set { base.Model = value; }
+    }
+
+    [StorableConstructor]
+    private GaussianProcessRegressionSolution(bool deserializing) : base(deserializing) { }
+    private GaussianProcessRegressionSolution(GaussianProcessRegressionSolution original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public GaussianProcessRegressionSolution(IGaussianProcessModel model, IRegressionProblemData problemData)
+      : base(model, problemData) {
+      RecalculateResults();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessRegressionSolution(this, cloner);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolutionCreator.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolutionCreator.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolutionCreator.cs	(revision 8430)
@@ -0,0 +1,96 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "GaussianProcessRegressionSolutionCreator",
+    Description = "Creates a Gaussian process solution from a trained model.")]
+  public sealed class GaussianProcessRegressionSolutionCreator : SingleSuccessorOperator {
+    private const string ProblemDataParameterName = "ProblemData";
+    private const string ModelParameterName = "GaussianProcessRegressionModel";
+    private const string SolutionParameterName = "Solution";
+    private const string ResultsParameterName = "Results";
+    private const string TrainingRSquaredResultName = "Training R²";
+    private const string TestRSquaredResultName = "Test R²";
+
+    #region Parameter Properties
+    public ILookupParameter<IRegressionProblemData> ProblemDataParameter {
+      get { return (ILookupParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName]; }
+    }
+    public ILookupParameter<IGaussianProcessSolution> SolutionParameter {
+      get { return (ILookupParameter<IGaussianProcessSolution>)Parameters[SolutionParameterName]; }
+    }
+    public ILookupParameter<IGaussianProcessModel> ModelParameter {
+      get { return (ILookupParameter<IGaussianProcessModel>)Parameters[ModelParameterName]; }
+    }
+    public ILookupParameter<ResultCollection> ResultsParameter {
+      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private GaussianProcessRegressionSolutionCreator(bool deserializing) : base(deserializing) { }
+    private GaussianProcessRegressionSolutionCreator(GaussianProcessRegressionSolutionCreator original, Cloner cloner) : base(original, cloner) { }
+    public GaussianProcessRegressionSolutionCreator()
+      : base() {
+      // in
+      Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The regression problem data for the Gaussian process solution."));
+      Parameters.Add(new LookupParameter<IGaussianProcessModel>(ModelParameterName, "The Gaussian process regression model to use for the solution."));
+      // in & out
+      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The result collection of the algorithm."));
+      // out
+      Parameters.Add(new LookupParameter<IGaussianProcessSolution>(SolutionParameterName, "The produced Gaussian process solution."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessRegressionSolutionCreator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var m = ModelParameter.ActualValue;
+      var data = ProblemDataParameter.ActualValue;
+      var s = new GaussianProcessRegressionSolution(m, data);
+
+
+      SolutionParameter.ActualValue = s;
+      var results = ResultsParameter.ActualValue;
+      if (!results.ContainsKey(SolutionParameterName)) {
+        results.Add(new Result(SolutionParameterName, "The Gaussian process regression solution", s));
+        results.Add(new Result(TrainingRSquaredResultName, "The Pearson's R² of the Gaussian process solution on the training partition.", new DoubleValue(s.TrainingRSquared)));
+        results.Add(new Result(TestRSquaredResultName, "The Pearson's R² of the Gaussian process solution on the test partition.", new DoubleValue(s.TestRSquared)));
+      } else {
+        results[SolutionParameterName].Value = s;
+        results[TrainingRSquaredResultName].Value = new DoubleValue(s.TrainingRSquared);
+        results[TestRSquaredResultName].Value = new DoubleValue(s.TestRSquared);
+      }
+      return base.Apply();
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs	(revision 8430)
@@ -0,0 +1,34 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Core;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  public interface ICovarianceFunction : IItem {
+    int GetNumberOfParameters(int numberOfVariables);
+    void SetParameter(double[] hyp);
+    void SetData(double[,] x);
+    void SetData(double[,] x, double[,] xt);
+
+    double GetCovariance(int i, int j);
+    double[] GetGradient(int i, int j);
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs	(revision 8430)
@@ -0,0 +1,31 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Core;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  public interface IMeanFunction : IItem {
+    int GetNumberOfParameters(int numberOfVariables);
+    void SetParameter(double[] hyp);
+    void SetData(double[,] x);
+    double[] GetMean(double[,] x);
+    double[] GetGradients(int k, double[,] x);
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs	(revision 8430)
@@ -0,0 +1,68 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "MeanConst", Description = "Constant mean function for Gaussian processes.")]
+  public class MeanConst : Item, IMeanFunction {
+    [Storable]
+    private double c;
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return 1;
+    }
+    [StorableConstructor]
+    protected MeanConst(bool deserializing) : base(deserializing) { }
+    protected MeanConst(MeanConst original, Cloner cloner)
+      : base(original, cloner) {
+      this.c = original.c;
+    }
+    public MeanConst()
+      : base() {
+    }
+
+    public void SetParameter(double[] hyp) {
+      if (hyp.Length != 1) throw new ArgumentException("Only one hyper-parameter allowed for constant mean function.", "hyp");
+      this.c = hyp[0];
+    }
+    public void SetData(double[,] x) {
+      // nothing to do
+    }
+
+    public double[] GetMean(double[,] x) {
+      return Enumerable.Repeat(c, x.GetLength(0)).ToArray();
+    }
+
+    public double[] GetGradients(int k, double[,] x) {
+      if (k > 0) throw new ArgumentException();
+      return Enumerable.Repeat(1.0, x.GetLength(0)).ToArray();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MeanConst(this, cloner);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanLinear.cs	(revision 8430)
@@ -0,0 +1,81 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "MeanLinear", Description = "Linear mean function for Gaussian processes.")]
+  public class MeanLinear : Item, IMeanFunction {
+    [Storable]
+    private double[] alpha;
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return numberOfVariables;
+    }
+    [StorableConstructor]
+    protected MeanLinear(bool deserializing) : base(deserializing) { }
+    protected MeanLinear(MeanLinear original, Cloner cloner)
+      : base(original, cloner) {
+      if (original.alpha != null) {
+        this.alpha = new double[original.alpha.Length];
+        Array.Copy(original.alpha, alpha, original.alpha.Length);
+      }
+    }
+    public MeanLinear()
+      : base() {
+    }
+
+    public void SetParameter(double[] hyp) {
+      this.alpha = new double[hyp.Length];
+      Array.Copy(hyp, alpha, hyp.Length);
+    }
+    public void SetData(double[,] x) {
+      // nothing to do
+    }
+
+    public double[] GetMean(double[,] x) {
+      // sanity check
+      if (alpha.Length != x.GetLength(1)) throw new ArgumentException("The number of hyperparameters must match the number of variables for the linear mean function.");
+      int cols = x.GetLength(1);
+      int n = x.GetLength(0);
+      return (from i in Enumerable.Range(0, n)
+              let rowVector = from j in Enumerable.Range(0, cols)
+                              select x[i, j]
+              select Util.ScalarProd(alpha, rowVector))
+        .ToArray();
+    }
+
+    public double[] GetGradients(int k, double[,] x) {
+      int cols = x.GetLength(1);
+      int n = x.GetLength(0);
+      if (k > cols) throw new ArgumentException();
+      return (from r in Enumerable.Range(0, n)
+              select x[r, k]).ToArray();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MeanLinear(this, cloner);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs	(revision 8430)
@@ -0,0 +1,62 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "MeanZero", Description = "Constant zero mean function for Gaussian processes.")]
+  public class MeanZero : Item, IMeanFunction {
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return 0;
+    }
+    [StorableConstructor]
+    protected MeanZero(bool deserializing) : base(deserializing) { }
+    protected MeanZero(MeanZero original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public MeanZero() {
+    }
+
+    public void SetParameter(double[] hyp) {
+      if (hyp.Length > 0) throw new ArgumentException("No hyper-parameters allowed for zero mean function.", "hyp");
+    }
+
+    public void SetData(double[,] x) {
+      // do nothing
+    }
+
+    public double[] GetMean(double[,] x) {
+      return Enumerable.Repeat(0.0, x.GetLength(0)).ToArray();
+    }
+
+    public double[] GetGradients(int k, double[,] x) {
+      if (k > 0) throw new ArgumentException();
+      return Enumerable.Repeat(0.0, x.GetLength(0)).ToArray();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MeanZero(this, cloner);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs	(revision 8430)
@@ -0,0 +1,50 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  public static class Util {
+    public static double ScalarProd(IEnumerable<double> v, IEnumerable<double> u) {
+      return v.Zip(u, (vi, ui) => vi * ui).Sum();
+    }
+
+    public static double SqrDist(double x, double y) {
+      double d = x - y;
+      return Math.Max(d * d, 0.0);
+    }
+
+    public static double SqrDist(IEnumerable<double> x, IEnumerable<double> y) {
+      return x.Zip(y, SqrDist).Sum();
+    }
+
+    public static IEnumerable<double> GetRow(double[,] x, int r) {
+      int cols = x.GetLength(1);
+      return Enumerable.Range(0, cols).Select(c => x[r, c]);
+    }
+    public static IEnumerable<double> GetCol(double[,] x, int c) {
+      int rows = x.GetLength(0);
+      return Enumerable.Range(0, rows).Select(r => x[r, c]);
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8430)
@@ -52,5 +52,5 @@
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
-    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
@@ -102,9 +102,63 @@
   <ItemGroup>
     <Reference Include="ALGLIB-3.5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\bin\ALGLIB-3.5.0.dll</HintPath>
+      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.5.0.dll</HintPath>
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Algorithms.Benchmarks-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.Benchmarks-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.GradientDescent-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.GradientDescent-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="LibSVM-1.6.3, Version=1.6.3.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
-      <HintPath>..\..\bin\LibSVM-1.6.3.dll</HintPath>
+      <HintPath>..\..\..\..\trunk\sources\bin\LibSVM-1.6.3.dll</HintPath>
       <Private>False</Private>
     </Reference>
@@ -113,7 +167,5 @@
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
-    <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
-    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
@@ -122,4 +174,27 @@
     </Compile>
     <Compile Include="FixedDataAnalysisAlgorithm.cs" />
+    <Compile Include="GaussianProcess\CovarianceProd.cs" />
+    <Compile Include="GaussianProcess\CovarianceSum.cs" />
+    <Compile Include="GaussianProcess\CovariancePeriodic.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessHyperparameterInitializer.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessRegressionSolutionCreator.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessRegressionModelCreator.cs" />
+    <Compile Include="GaussianProcess\CovarianceLinear.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessModelCreator.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="GaussianProcess\MeanLinear.cs" />
+    <Compile Include="GaussianProcess\Util.cs" />
+    <Compile Include="GaussianProcess\MeanZero.cs" />
+    <Compile Include="GaussianProcess\MeanConst.cs" />
+    <Compile Include="GaussianProcess\IMeanFunction.cs" />
+    <Compile Include="GaussianProcess\CovarianceSEard.cs" />
+    <Compile Include="GaussianProcess\CovarianceSEiso.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessModel.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessRegression.cs" />
+    <Compile Include="GaussianProcess\GaussianProcessRegressionSolution.cs" />
+    <Compile Include="GaussianProcess\ICovarianceFunction.cs" />
+    <Compile Include="Interfaces\IGaussianProcessModel.cs" />
+    <Compile Include="Interfaces\IGaussianProcessSolution.cs" />
     <Compile Include="Interfaces\INearestNeighbourClassificationSolution.cs" />
     <Compile Include="Interfaces\INearestNeighbourRegressionSolution.cs" />
@@ -144,4 +219,5 @@
     </Compile>
     <Compile Include="Linear\AlglibUtil.cs" />
+    <Compile Include="Linear\Scaling.cs" />
     <Compile Include="Linear\LinearDiscriminantAnalysis.cs" />
     <Compile Include="Linear\LinearRegression.cs">
@@ -185,80 +261,22 @@
       <SubType>Code</SubType>
     </Compile>
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
-      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
-      <Name>HeuristicLab.Collections-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
-      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
-      <Name>HeuristicLab.Common.Resources-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
-      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
-      <Name>HeuristicLab.Common-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
-      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
-      <Name>HeuristicLab.Core-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
-      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
-      <Name>HeuristicLab.Data-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
+    <Compile Include="TimeSeries\AutoregressiveModeling.cs" />
+  </ItemGroup>
+  <ItemGroup>
     <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
       <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
       <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
-      <Private>False</Private>
     </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
-      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
-      <Name>HeuristicLab.Optimization-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
-      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
-      <Name>HeuristicLab.Parameters-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
-      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
-      <Name>HeuristicLab.Persistence-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
-      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
-      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj">
-      <Project>{05BAE4E1-A9FA-4644-AA77-42558720159E}</Project>
-      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj">
-      <Project>{5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}</Project>
-      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4</Name>
-      <Private>False</Private>
+    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4.csproj">
+      <Project>{07486E68-1517-4B9D-A58D-A38E99AE71AB}</Project>
+      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4</Name>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
       <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
-      <Private>False</Private>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
       <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project>
       <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
-      <Private>False</Private>
-    </ProjectReference>
-    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
-      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
-      <Name>HeuristicLab.Problems.Instances-3.3</Name>
-      <Private>False</Private>
     </ProjectReference>
   </ItemGroup>
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IDataAnalysisAlgorithm.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IDataAnalysisAlgorithm.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IDataAnalysisAlgorithm.cs	(revision 8430)
@@ -28,5 +28,5 @@
   /// </summary>
   public interface IDataAnalysisAlgorithm<T> : IAlgorithm where T : class, IDataAnalysisProblem {
-    new T Problem { get; }
+    new T Problem { get; set; }
   }
 }
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8430)
@@ -0,0 +1,34 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  /// <summary>
+  /// Interface to represent a Gaussian process posterior
+  /// </summary>
+  public interface IGaussianProcessModel : IRegressionModel {
+    double NegativeLogLikelihood { get; }
+    IMeanFunction MeanFunction { get; }
+    ICovarianceFunction CovarianceFunction { get; }
+    double[] GetHyperparameterGradients();
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs	(revision 8430)
@@ -0,0 +1,31 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  /// <summary>
+  /// Interface to represent a Gaussian process solution (either regression or classification)
+  /// </summary>
+  public interface IGaussianProcessSolution : IDataAnalysisSolution {
+    new IGaussianProcessModel Model { get; }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs	(revision 8430)
@@ -45,4 +45,23 @@
       return matrix;
     }
+    public static double[,] PrepareAndScaleInputMatrix(Dataset dataset, IEnumerable<string> variables, IEnumerable<int> rows, Scaling scaling) {
+      List<string> variablesList = variables.ToList();
+      List<int> rowsList = rows.ToList();
+
+      double[,] matrix = new double[rowsList.Count, variablesList.Count];
+
+      int col = 0;
+      foreach (string column in variables) {
+        var values = scaling.GetScaledValues(dataset, column, rows);
+        int row = 0;
+        foreach (var value in values) {
+          matrix[row, col] = value;
+          row++;
+        }
+        col++;
+      }
+
+      return matrix;
+    }
   }
 }
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs	(revision 8430)
@@ -68,5 +68,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       int nClasses = problemData.ClassNames.Count();
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs	(revision 8430)
@@ -72,5 +72,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs	(revision 8430)
@@ -69,5 +69,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
@@ -81,10 +81,10 @@
       int nClasses = classValues.Count();
       // map original class values to values [0..nClasses-1]
-      Dictionary<double, double> classIndizes = new Dictionary<double, double>();
+      Dictionary<double, double> classIndices = new Dictionary<double, double>();
       for (int i = 0; i < nClasses; i++) {
-        classIndizes[classValues[i]] = i;
+        classIndices[classValues[i]] = i;
       }
       for (int row = 0; row < nRows; row++) {
-        inputMatrix[row, nFeatures] = classIndizes[inputMatrix[row, nFeatures]];
+        inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]];
       }
       int info;
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/Scaling.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/Scaling.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/Scaling.cs	(revision 8430)
@@ -0,0 +1,62 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "Scaling", Description = "Contains information about scaling of variables for data-analysis algorithms.")]
+  public class Scaling : Item {
+    [Storable]
+    private Dictionary<string, Tuple<double, double>> scalingParameters = new Dictionary<string, Tuple<double, double>>();
+    [StorableConstructor]
+    protected Scaling(bool deserializing) : base(deserializing) { }
+    protected Scaling(Scaling original, Cloner cloner)
+      : base(original, cloner) {
+      foreach (var pair in original.scalingParameters)
+        scalingParameters.Add(pair.Key, Tuple.Create(pair.Value.Item1, pair.Value.Item2));
+    }
+    public Scaling(Dataset ds, IEnumerable<string> variables, IEnumerable<int> rows) {
+      foreach (var variable in variables) {
+        var values = ds.GetDoubleValues(variable, rows);
+        var min = values.Min();
+        var max = values.Max();
+        scalingParameters[variable] = Tuple.Create(min, max);
+      }
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new Scaling(this, cloner);
+    }
+
+    public IEnumerable<double> GetScaledValues(Dataset ds, string variable, IEnumerable<int> rows) {
+      double min = scalingParameters[variable].Item1;
+      double max = scalingParameters[variable].Item2;
+      return ds.GetDoubleValues(variable, rows).Select(x => (x - min) / (max - min));
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs	(revision 8430)
@@ -87,5 +87,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
@@ -99,10 +99,10 @@
       int nClasses = classValues.Count();
       // map original class values to values [0..nClasses-1]
-      Dictionary<double, double> classIndizes = new Dictionary<double, double>();
+      Dictionary<double, double> classIndices = new Dictionary<double, double>();
       for (int i = 0; i < nClasses; i++) {
-        classIndizes[classValues[i]] = i;
+        classIndices[classValues[i]] = i;
       }
       for (int row = 0; row < nRows; row++) {
-        inputMatrix[row, nFeatures] = classIndizes[inputMatrix[row, nFeatures]];
+        inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]];
       }
       alglib.nearestneighbor.kdtreebuild(inputMatrix, nRows, inputMatrix.GetLength(1) - 1, 1, 2, kdtree);
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourRegression.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourRegression.cs	(revision 8430)
@@ -87,5 +87,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs	(revision 8430)
@@ -53,6 +53,6 @@
       get { return (IFixedValueParameter<DoubleValue>)Parameters[DecayParameterName]; }
     }
-    public ConstrainedValueParameter<IntValue> HiddenLayersParameter {
-      get { return (ConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
+    public IConstrainedValueParameter<IntValue> HiddenLayersParameter {
+      get { return (IConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
     }
     public IFixedValueParameter<IntValue> NodesInFirstHiddenLayerParameter {
@@ -185,5 +185,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
@@ -195,10 +195,10 @@
       int nClasses = classValues.Count();
       // map original class values to values [0..nClasses-1]
-      Dictionary<double, double> classIndizes = new Dictionary<double, double>();
+      Dictionary<double, double> classIndices = new Dictionary<double, double>();
       for (int i = 0; i < nClasses; i++) {
-        classIndizes[classValues[i]] = i;
+        classIndices[classValues[i]] = i;
       }
       for (int row = 0; row < nRows; row++) {
-        inputMatrix[row, nFeatures] = classIndizes[inputMatrix[row, nFeatures]];
+        inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]];
       }
 
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs	(revision 8430)
@@ -57,6 +57,6 @@
       get { return (IFixedValueParameter<DoubleValue>)Parameters[DecayParameterName]; }
     }
-    public ConstrainedValueParameter<IntValue> HiddenLayersParameter {
-      get { return (ConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
+    public IConstrainedValueParameter<IntValue> HiddenLayersParameter {
+      get { return (IConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
     }
     public IFixedValueParameter<IntValue> NodesInFirstHiddenLayerParameter {
@@ -171,5 +171,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
@@ -181,10 +181,10 @@
       int nClasses = classValues.Count();
       // map original class values to values [0..nClasses-1]
-      Dictionary<double, double> classIndizes = new Dictionary<double, double>();
+      Dictionary<double, double> classIndices = new Dictionary<double, double>();
       for (int i = 0; i < nClasses; i++) {
-        classIndizes[classValues[i]] = i;
+        classIndices[classValues[i]] = i;
       }
       for (int row = 0; row < nRows; row++) {
-        inputMatrix[row, nFeatures] = classIndizes[inputMatrix[row, nFeatures]];
+        inputMatrix[row, nFeatures] = classIndices[inputMatrix[row, nFeatures]];
       }
 
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs	(revision 8430)
@@ -57,6 +57,6 @@
       get { return (IFixedValueParameter<DoubleValue>)Parameters[DecayParameterName]; }
     }
-    public ConstrainedValueParameter<IntValue> HiddenLayersParameter {
-      get { return (ConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
+    public IConstrainedValueParameter<IntValue> HiddenLayersParameter {
+      get { return (IConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
     }
     public IFixedValueParameter<IntValue> NodesInFirstHiddenLayerParameter {
@@ -170,5 +170,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs	(revision 8430)
@@ -26,11 +26,8 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Problems.DataAnalysis;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
-using HeuristicLab.Parameters;
 
 namespace HeuristicLab.Algorithms.DataAnalysis {
@@ -53,6 +50,6 @@
       get { return (IFixedValueParameter<DoubleValue>)Parameters[DecayParameterName]; }
     }
-    public ConstrainedValueParameter<IntValue> HiddenLayersParameter {
-      get { return (ConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
+    public IConstrainedValueParameter<IntValue> HiddenLayersParameter {
+      get { return (IConstrainedValueParameter<IntValue>)Parameters[HiddenLayersParameterName]; }
     }
     public IFixedValueParameter<IntValue> NodesInFirstHiddenLayerParameter {
@@ -186,5 +183,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame	(revision 8430)
@@ -26,8 +26,9 @@
   /// Plugin class for HeuristicLab.Algorithms.DataAnalysis plugin.
   /// </summary>
-  [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.2.$WCREV$")]
+  [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.3.$WCREV$")]
   [PluginFile("HeuristicLab.Algorithms.DataAnalysis-3.4.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.ALGLIB", "3.5.0")]
-  [PluginDependency("HeuristicLab.LibSVM", "1.6.3")]
+  [PluginDependency("HeuristicLab.Algorithms.GradientDescent", "3.3")]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
   [PluginDependency("HeuristicLab.Common", "3.3")]
@@ -35,5 +36,7 @@
   [PluginDependency("HeuristicLab.Core", "3.3")]
   [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
+  [PluginDependency("HeuristicLab.Operators", "3.3")]
   [PluginDependency("HeuristicLab.Optimization", "3.3")]
   [PluginDependency("HeuristicLab.Parameters", "3.3")]
@@ -43,4 +46,5 @@
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification", "3.4")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")]
+  [PluginDependency("HeuristicLab.LibSVM", "1.6.3")]
   public class HeuristicLabAlgorithmsDataAnalysisPlugin : PluginBase {
   }
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Properties/AssemblyInfo.cs.frame	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/Properties/AssemblyInfo.cs.frame	(revision 8430)
@@ -53,3 +53,3 @@
 // by using the '*' as shown below:
 [assembly: AssemblyVersion("3.4.0.0")]
-[assembly: AssemblyFileVersion("3.4.2.$WCREV$")]
+[assembly: AssemblyFileVersion("3.4.3.$WCREV$")]
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs	(revision 8430)
@@ -97,5 +97,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
@@ -111,10 +111,10 @@
       int nClasses = classValues.Count();
       // map original class values to values [0..nClasses-1]
-      Dictionary<double, double> classIndizes = new Dictionary<double, double>();
+      Dictionary<double, double> classIndices = new Dictionary<double, double>();
       for (int i = 0; i < nClasses; i++) {
-        classIndizes[classValues[i]] = i;
+        classIndices[classValues[i]] = i;
       }
       for (int row = 0; row < nRows; row++) {
-        inputMatrix[row, nCols - 1] = classIndizes[inputMatrix[row, nCols - 1]];
+        inputMatrix[row, nCols - 1] = classIndices[inputMatrix[row, nCols - 1]];
       }
       // execute random forest algorithm
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs	(revision 8430)
@@ -97,5 +97,5 @@
       string targetVariable = problemData.TargetVariable;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       double[,] inputMatrix = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables.Concat(new string[] { targetVariable }), rows);
       if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs	(revision 8430)
@@ -46,9 +46,9 @@
 
     #region parameter properties
-    public IValueParameter<StringValue> SvmTypeParameter {
-      get { return (IValueParameter<StringValue>)Parameters[SvmTypeParameterName]; }
+    public IConstrainedValueParameter<StringValue> SvmTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[SvmTypeParameterName]; }
     }
-    public IValueParameter<StringValue> KernelTypeParameter {
-      get { return (IValueParameter<StringValue>)Parameters[KernelTypeParameterName]; }
+    public IConstrainedValueParameter<StringValue> KernelTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[KernelTypeParameterName]; }
     }
     public IValueParameter<DoubleValue> NuParameter {
@@ -65,7 +65,9 @@
     public StringValue SvmType {
       get { return SvmTypeParameter.Value; }
+      set { SvmTypeParameter.Value = value; }
     }
     public StringValue KernelType {
       get { return KernelTypeParameter.Value; }
+      set { KernelTypeParameter.Value = value; }
     }
     public DoubleValue Nu {
@@ -130,5 +132,5 @@
       Dataset dataset = problemData.Dataset;
       string targetVariable = problemData.TargetVariable;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
 
       //extract SVM parameters from scope and set them
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs	(revision 8430)
@@ -162,5 +162,5 @@
       // calculate predictions for the currently requested rows
       SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, targetVariable, allowedInputVariables, rows);
-      SVM.Problem scaledProblem = Scaling.Scale(RangeTransform, problem);
+      SVM.Problem scaledProblem = SVM.Scaling.Scale(RangeTransform, problem);
 
       for (int i = 0; i < scaledProblem.Count; i++) {
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs	(revision 8430)
@@ -47,9 +47,9 @@
 
     #region parameter properties
-    public IValueParameter<StringValue> SvmTypeParameter {
-      get { return (IValueParameter<StringValue>)Parameters[SvmTypeParameterName]; }
+    public IConstrainedValueParameter<StringValue> SvmTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[SvmTypeParameterName]; }
     }
-    public IValueParameter<StringValue> KernelTypeParameter {
-      get { return (IValueParameter<StringValue>)Parameters[KernelTypeParameterName]; }
+    public IConstrainedValueParameter<StringValue> KernelTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[KernelTypeParameterName]; }
     }
     public IValueParameter<DoubleValue> NuParameter {
@@ -69,7 +69,9 @@
     public StringValue SvmType {
       get { return SvmTypeParameter.Value; }
+      set { SvmTypeParameter.Value = value; }
     }
     public StringValue KernelType {
       get { return KernelTypeParameter.Value; }
+      set { KernelTypeParameter.Value = value; }
     }
     public DoubleValue Nu {
@@ -138,5 +140,5 @@
       Dataset dataset = problemData.Dataset;
       string targetVariable = problemData.TargetVariable;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
 
       //extract SVM parameters from scope and set them
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs	(revision 8430)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs	(revision 8430)
@@ -0,0 +1,139 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.TimeSeries {
+  [Item("Autoregressive Modeling", "Timeseries modeling algorithm that creates AR-N models.")]
+  [Creatable("Data Analysis")]
+  [StorableClass]
+  public class AutoregressiveModeling : FixedDataAnalysisAlgorithm<ITimeSeriesPrognosisProblem> {
+    private const string TimeOffesetParameterName = "Maximum Time Offset";
+
+    public IFixedValueParameter<IntValue> TimeOffsetParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[TimeOffesetParameterName]; }
+    }
+
+
+    public int TimeOffset {
+      get { return TimeOffsetParameter.Value.Value; }
+      set { TimeOffsetParameter.Value.Value = value; }
+    }
+
+    [StorableConstructor]
+    protected AutoregressiveModeling(bool deserializing) : base(deserializing) { }
+    protected AutoregressiveModeling(AutoregressiveModeling original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new AutoregressiveModeling(this, cloner);
+    }
+
+    public AutoregressiveModeling()
+      : base() {
+      Parameters.Add(new FixedValueParameter<IntValue>(TimeOffesetParameterName, "The maximum time offset for the model ranging from 1 to infinity.", new IntValue(1)));
+      Problem = new TimeSeriesPrognosisProblem();
+    }
+
+    protected override void Run() {
+      double rmsError, cvRmsError;
+      var solution = CreateAutoRegressiveSolution(Problem.ProblemData, TimeOffset, out rmsError, out cvRmsError);
+      Results.Add(new Result("Autoregressive solution", "The autoregressive time series prognosis solution.", solution));
+      Results.Add(new Result("Root mean square error", "The root of the mean of squared errors of the autoregressive time series prognosis solution on the training set.", new DoubleValue(rmsError)));
+      Results.Add(new Result("Estimated root mean square error (cross-validation)", "The estimated root of the mean of squared errors of the autoregressive time series prognosis solution via cross validation.", new DoubleValue(cvRmsError)));
+    }
+
+    /// <summary>
+    /// Calculates an AR(p) model. For further information see http://en.wikipedia.org/wiki/Autoregressive_model
+    /// </summary>
+    /// <param name="problemData">The problem data which should be used for training</param>
+    /// <param name="timeOffset">The parameter p of the AR(p) specifying the maximum time offset [1,infinity] </param>
+    /// <returns>The times series autoregressive solution </returns>
+    public ITimeSeriesPrognosisSolution CreateAutoRegressiveSolution(ITimeSeriesPrognosisProblemData problemData, int timeOffset) {
+      double rmsError, cvRmsError;
+      return CreateAutoRegressiveSolution(problemData, timeOffset, out rmsError, out cvRmsError);
+    }
+
+    internal ITimeSeriesPrognosisSolution CreateAutoRegressiveSolution(ITimeSeriesPrognosisProblemData problemData, int timeOffset, out double rmsError, out double cvRmsError) {
+      Dataset dataset = problemData.Dataset;
+      string targetVariable = problemData.TargetVariable;
+
+      double[,] inputMatrix = new double[problemData.TrainingPartition.Size, timeOffset + 1];
+      var targetValues = problemData.Dataset.GetReadOnlyDoubleValues(targetVariable);
+      for (int i = 0, row = problemData.TrainingPartition.Start; i < problemData.TrainingPartition.Size; i++, row++) {
+        for (int col = 0; col < timeOffset + 1; col++) {
+          inputMatrix[i, col] = targetValues[row - col];
+        }
+      }
+
+      if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))
+        throw new NotSupportedException("Linear regression does not support NaN or infinity values in the input dataset.");
+
+
+      alglib.linearmodel lm = new alglib.linearmodel();
+      alglib.lrreport ar = new alglib.lrreport();
+      int nRows = inputMatrix.GetLength(0);
+      int nFeatures = inputMatrix.GetLength(1) - 1;
+      double[] coefficients = new double[nFeatures + 1]; // last coefficient is for the constant
+
+      int retVal = 1;
+      alglib.lrbuild(inputMatrix, nRows, nFeatures, out retVal, out lm, out ar);
+      if (retVal != 1) throw new ArgumentException("Error in calculation of linear regression solution");
+      rmsError = ar.rmserror;
+      cvRmsError = ar.cvrmserror;
+
+      alglib.lrunpack(lm, out coefficients, out nFeatures);
+
+
+      ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
+      ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
+      tree.Root.AddSubtree(startNode);
+      ISymbolicExpressionTreeNode addition = new Addition().CreateTreeNode();
+      startNode.AddSubtree(addition);
+
+      for (int i = 0; i < timeOffset; i++) {
+        LaggedVariableTreeNode node = (LaggedVariableTreeNode)new HeuristicLab.Problems.DataAnalysis.Symbolic.LaggedVariable().CreateTreeNode();
+        node.VariableName = targetVariable;
+        node.Weight = coefficients[i];
+        node.Lag = (i + 1) * -1;
+        addition.AddSubtree(node);
+      }
+
+      ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();
+      cNode.Value = coefficients[coefficients.Length - 1];
+      addition.AddSubtree(cNode);
+
+      var interpreter = new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter(problemData.TargetVariable);
+      var model = new SymbolicTimeSeriesPrognosisModel(tree, interpreter);
+      var solution = model.CreateTimeSeriesPrognosisSolution((ITimeSeriesPrognosisProblemData)problemData.Clone());
+      return solution;
+    }
+  }
+}
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs	(revision 8430)
@@ -85,5 +85,5 @@
       Dataset dataset = problemData.Dataset;
       IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
-      IEnumerable<int> rows = problemData.TrainingIndizes;
+      IEnumerable<int> rows = problemData.TrainingIndices;
       int info;
       double[,] centers;
Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringSolution.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringSolution.cs	(revision 8116)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringSolution.cs	(revision 8430)
@@ -52,6 +52,6 @@
     public KMeansClusteringSolution(KMeansClusteringModel model, IClusteringProblemData problemData)
       : base(model, problemData) {
-      double trainingIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TrainingIndizes);
-      double testIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TestIndizes);
+      double trainingIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TrainingIndices);
+      double testIntraClusterSumOfSquares = KMeansClusteringUtil.CalculateIntraClusterSumOfSquares(model, problemData.Dataset, problemData.TestIndices);
       this.Add(new Result(TrainingIntraClusterSumOfSquaresResultName, "The sum of squared distances of points of the training partition to the cluster center (is minimized by k-Means).", new DoubleValue(trainingIntraClusterSumOfSquares)));
       this.Add(new Result(TestIntraClusterSumOfSquaresResultName, "The sum of squared distances of points of the test partition to the cluster center (is minimized by k-Means).", new DoubleValue(testIntraClusterSumOfSquares)));
