Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceNNOne.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceNNOne.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceNNOne.cs	(revision 8323)
@@ -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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs	(revision 8323)
@@ -0,0 +1,104 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  public class CovariancePeriodic : ICovarianceFunction {
+    private double[,] x;
+    private double[,] xt;
+    private double sf2;
+    private double l;
+    private double[,] sd;
+    private double p;
+
+    public int NumberOfParameters {
+      get { return 2; }
+    }
+
+    public CovariancePeriodic(double p) {
+      this.p = p;
+    }
+
+    public void SetMatrix(double[,] x) {
+      SetMatrix(x, x);
+    }
+
+    public void SetMatrix(double[,] x, double[,] xt) {
+      this.x = x;
+      this.xt = xt;
+      sd = null;
+    }
+
+    public void SetHyperparamter(double[] hyp) {
+      if (hyp.Length != 2) throw new ArgumentException();
+      this.l = Math.Exp(hyp[0]);
+      this.sf2 = Math.Exp(2 * hyp[1]);
+      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(SqrDist(GetRow(x, i), 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[] GetDerivatives(int i, int j) {
+
+      var res = new double[2];
+      double k = sd[i, j];
+      k = Math.PI * k / p;
+      k = Math.Sin(k) / l;
+      k = k * k;
+      res[0] = 4 * sf2 * Math.Exp(-2 * k) * k;
+      res[1] = 2 * sf2 * Math.Exp(-2 * k);
+      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];
+      bool symmetric = x == xt;
+      for (int i = 0; i < rows; i++) {
+        for (int j = i; j < rows; j++) {
+          sd[i, j] = Math.Sqrt(SqrDist(GetRow(x, i), GetRow(xt, j)));
+          if (symmetric) {
+            sd[j, i] = sd[i, j];
+          } else {
+            sd[j, i] = Math.Sqrt(SqrDist(GetRow(x, j), GetRow(xt, i)));
+          }
+        }
+      }
+    }
+
+
+    private double SqrDist(IEnumerable<double> x, IEnumerable<double> y) {
+      var d0 = x.Zip(y, (a, b) => (a - b) * (a - b));
+      return Math.Max(0, d0.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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs	(revision 8323)
@@ -0,0 +1,57 @@
+﻿using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  public class CovarianceProd : ICovarianceFunction {
+    private IList<ICovarianceFunction> covariances;
+
+    public int NumberOfParameters {
+      get { return covariances.Sum(c => c.NumberOfParameters); }
+    }
+
+    public CovarianceProd(IEnumerable<ICovarianceFunction> covariances) {
+      this.covariances = covariances.ToList();
+    }
+
+    public void SetMatrix(double[,] x) {
+      foreach (var covariance in covariances) {
+        covariance.SetMatrix(x, x);
+      }
+    }
+
+    public void SetMatrix(double[,] x, double[,] xt) {
+      foreach (var covariance in covariances) {
+        covariance.SetMatrix(x, xt);
+      }
+    }
+
+    public void SetHyperparamter(double[] hyp) {
+      int i = 0;
+      foreach (var covariance in covariances) {
+        int n = covariance.NumberOfParameters;
+        covariance.SetHyperparamter(hyp.Skip(i).Take(n).ToArray());
+        i += n;
+      }
+    }
+
+    public double GetCovariance(int i, int j) {
+      return covariances.Select(c => c.GetCovariance(i, j))
+        .Aggregate((a, b) => a * b);
+    }
+
+
+    public double[] GetDiagonalCovariances() {
+      return covariances
+        .Select(c => c.GetDiagonalCovariances())
+        .Aggregate((s, d) => s.Zip(d, (a, b) => a * b).ToArray())
+        .ToArray();
+    }
+
+    public double[] GetDerivatives(int i, int j) {
+      return covariances
+        .Select(c => c.GetDerivatives(i, j))
+        .Aggregate(Enumerable.Empty<double>(), (h0, h1) => h0.Concat(h1))
+        .ToArray();
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEard.cs	(revision 8323)
@@ -0,0 +1,111 @@
+﻿using System;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  [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) {
+      // note: using shallow copies here!
+      this.x = original.x;
+      this.xt = original.xt;
+      this.sf2 = original.sf2;
+      this.l = original.l;
+    }
+    public CovarianceSEard()
+      : base() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CovarianceSEard(this, cloner);
+    }
+
+    public void SetParameter(double[] hyp, double[,] x) {
+      SetParameter(hyp, x, x);
+      this.symmetric = true;
+    }
+
+    public void SetParameter(double[] hyp, double[,] x, double[,] xt) {
+      this.x = x;
+      this.xt = xt;
+      this.symmetric = false;
+
+      this.l = new double[hyp.Length - 1];
+      Array.Copy(hyp, l, l.Length);
+      this.sf2 = Math.Exp(2 * hyp[hyp.Length - 1]);
+      sd = null;
+    }
+
+    public double GetCovariance(int i, int j) {
+      if (sd == null) CalculateSquaredDistances();
+      return sf2 * Math.Exp(-sd[i, j] / 2.0);
+    }
+
+
+    public double[] GetDiagonalCovariances() {
+      if (x != xt) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      var sd = new double[rows];
+      for (int i = 0; i < rows; i++) {
+        sd[i] = Util.SqrDist(Util.GetRow(x, i).Select((e, k) => e / l[k]), Util.GetRow(xt, i).Select((e, k) => e / l[k]));
+      }
+      return sd.Select(d => sf2 * Math.Exp(-d / 2.0)).ToArray();
+    }
+
+    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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSEiso.cs	(revision 8323)
@@ -0,0 +1,112 @@
+﻿using System;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  [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) {
+      // note: using shallow copies here
+      this.x = original.x;
+      this.xt = original.xt;
+      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, double[,] x) {
+      SetParameter(hyp, x, x);
+      this.symmetric = true;
+    }
+
+
+    public void SetParameter(double[] hyp, double[,] x, double[,] xt) {
+      this.l = Math.Exp(hyp[0]);
+      this.sf2 = Math.Exp(2 * hyp[1]);
+
+      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[] GetDiagonalCovariances() {
+      if (x != xt) throw new InvalidOperationException();
+      int rows = x.GetLength(0);
+      var sd = new double[rows];
+      for (int i = 0; i < rows; i++) {
+        sd[i] = Util.SqrDist(Util.GetRow(x, i).Select(e => e / l), Util.GetRow(xt, i).Select(e => e / l));
+      }
+      return sd.Select(d => sf2 * Math.Exp(-d / 2.0)).ToArray();
+    }
+
+
+    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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSum.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSum.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceSum.cs	(revision 8323)
@@ -0,0 +1,56 @@
+﻿using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  public class CovarianceSum : ICovarianceFunction {
+    private IList<ICovarianceFunction> covariances;
+
+    public int NumberOfParameters {
+      get { return covariances.Sum(c => c.NumberOfParameters); }
+    }
+
+    public CovarianceSum(IEnumerable<ICovarianceFunction> covariances) {
+      this.covariances = covariances.ToList();
+    }
+
+    public void SetMatrix(double[,] x) {
+      foreach (var covariance in covariances) {
+        covariance.SetMatrix(x, x);
+      }
+    }
+
+    public void SetMatrix(double[,] x, double[,] xt) {
+      foreach (var covariance in covariances) {
+        covariance.SetMatrix(x, xt);
+      }
+    }
+
+    public void SetHyperparamter(double[] hyp) {
+      int i = 0;
+      foreach (var covariance in covariances) {
+        int n = covariance.NumberOfParameters;
+        covariance.SetHyperparamter(hyp.Skip(i).Take(n).ToArray());
+        i += n;
+      }
+    }
+
+    public double GetCovariance(int i, int j) {
+      return covariances.Select(c => c.GetCovariance(i, j)).Sum();
+    }
+
+
+    public double[] GetDiagonalCovariances() {
+      return covariances
+        .Select(c => c.GetDiagonalCovariances())
+        .Aggregate((s, d) => s.Zip(d, (a, b) => a + b).ToArray())
+        .ToArray();
+    }
+
+    public double[] GetDerivatives(int i, int j) {
+      return covariances
+        .Select(c => c.GetDerivatives(i, j))
+        .Aggregate(Enumerable.Empty<double>(), (h0, h1) => h0.Concat(h1))
+        .ToArray();
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8323)
@@ -0,0 +1,279 @@
+#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.GaussianProcess {
+  /// <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 double[] hyp;
+    public IEnumerable<double> Hyperparameters {
+      get { return hyp; }
+    }
+    [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[] meanHyp;
+    [Storable]
+    private double[] covHyp;
+
+    [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.hyp = original.hyp;
+      this.meanFunction = cloner.Clone(original.meanFunction);
+      this.covarianceFunction = cloner.Clone(original.covarianceFunction);
+      this.negativeLogLikelihood = original.negativeLogLikelihood;
+      this.targetVariable = original.targetVariable;
+      this.allowedInputVariables = original.allowedInputVariables;
+      this.alpha = original.alpha;
+      this.sqrSigmaNoise = original.sqrSigmaNoise;
+      this.scaling = cloner.Clone(original.scaling);
+      this.meanHyp = original.meanHyp;
+      this.covHyp = original.covHyp;
+      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.hyp = hyp.ToArray();
+      this.meanFunction = meanFunction;
+      this.covarianceFunction = covarianceFunction;
+      this.targetVariable = targetVariable;
+      this.allowedInputVariables = allowedInputVariables.ToArray();
+      int nAllowedVariables = allowedInputVariables.Count();
+
+      sqrSigmaNoise = Math.Exp(2.0 * hyp.First());
+      sqrSigmaNoise = Math.Max(10E-6, sqrSigmaNoise); // lower limit for the noise level
+      meanHyp = hyp.Skip(1).Take(meanFunction.GetNumberOfParameters(nAllowedVariables)).ToArray();
+      covHyp = hyp.Skip(1 + meanFunction.GetNumberOfParameters(nAllowedVariables)).Take(covarianceFunction.GetNumberOfParameters(nAllowedVariables)).ToArray();
+
+      CalculateModel(ds, targetVariable, allowedInputVariables, rows);
+    }
+
+    private void CalculateModel(Dataset ds, string targetVariable, IEnumerable<string> allowedInputVariables, 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.SetParameter(meanHyp, x);
+      covarianceFunction.SetParameter(covHyp, x);
+
+      // calculate means and covariances
+      double[] m = meanFunction.GetMean();
+      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);
+        meanGradients[i] = -Util.ScalarProd(meanGrad, alpha);
+      }
+
+      double[] covGradients = new double[covarianceFunction.GetNumberOfParameters(nAllowedVariables)];
+      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.SetParameter(covHyp, x, newX);
+      meanFunction.SetParameter(meanHyp, newX);
+      var ms = meanFunction.GetMean();
+      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;
+      }
+
+    }
+
+    #region events
+    public event EventHandler Changed;
+    private void OnChanged(EventArgs e) {
+      var handlers = Changed;
+      if (handlers != null)
+        handlers(this, e);
+    }
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 8323)
@@ -0,0 +1,218 @@
+
+#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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  /// <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 : FixedDataAnalysisAlgorithm<IRegressionProblem> {
+    private const string MeanFunctionParameterName = "MeanFunction";
+    private const string CovarianceFunctionParameterName = "CovarianceFunction";
+    private const string MinimizationIterationsParameterName = "MinimizationIterations";
+    private const string NegativeLogLikelihoodTableParameterName = "NegativeLogLikelihoodTable";
+    private const string HyperParametersTableParameterName = "HyperParametersTable";
+
+    #region parameter properties
+    public IValueParameter<IMeanFunction> MeanFunctionParameter {
+      get { return (IValueParameter<IMeanFunction>)Parameters[MeanFunctionParameterName]; }
+    }
+    public IValueParameter<ICovarianceFunction> CovarianceFunctionParameter {
+      get { return (IValueParameter<ICovarianceFunction>)Parameters[CovarianceFunctionParameterName]; }
+    }
+    public IValueParameter<IntValue> MinimizationIterationsParameter {
+      get { return (IValueParameter<IntValue>)Parameters[MinimizationIterationsParameterName]; }
+    }
+    //public ILookupParameter<DataTable> NegativeLogLikelihoodTableParameter {
+    //  get { return (ILookupParameter<DataTable>)Parameters[NegativeLogLikelihoodTableParameterName]; }
+    //}
+    //public ILookupParameter<DataTable> HyperParametersTableParameter {
+    //  get { return (ILookupParameter<DataTable>)Parameters[HyperParametersTableParameterName]; }
+    //}
+    #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() {
+      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.", new IntValue(20)));
+      //Parameters.Add(new LookupParameter<DataTable>(NegativeLogLikelihoodTableParameterName, "The negative log likelihood values over the whole run."));
+      //Parameters.Add(new LookupParameter<DataTable>(HyperParametersTableParameterName, "The values of the hyper-parameters over the whole run."));
+    }
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new GaussianProcessRegression(this, cloner);
+    }
+
+    #region Gaussian process regression
+    protected override void Run() {
+      IRegressionProblemData problemData = Problem.ProblemData;
+
+      int nAllowedVariables = problemData.AllowedInputVariables.Count();
+      var mt = new MersenneTwister();
+
+      var hyp0 =
+        Enumerable.Range(0,
+                         1 + MeanFunction.GetNumberOfParameters(nAllowedVariables) +
+                         CovarianceFunction.GetNumberOfParameters(nAllowedVariables))
+          .Select(i => mt.NextDouble())
+          .ToArray();
+
+      double[] hyp;
+
+      // find hyperparameters
+
+      double epsg = 0;
+      double epsf = 0.00001;
+      double epsx = 0;
+
+      alglib.minlbfgsstate state;
+      alglib.minlbfgsreport rep;
+
+      alglib.minlbfgscreate(1, hyp0, out state);
+      alglib.minlbfgssetcond(state, epsg, epsf, epsx, MinimizationIterations);
+      alglib.minlbfgssetxrep(state, true);
+      alglib.minlbfgsoptimize(state, OptimizeGaussianProcessParameters, Report, new object[] { MeanFunction, CovarianceFunction, problemData });
+      alglib.minlbfgsresults(state, out hyp, out rep);
+
+
+      double trainR2, testR2, negativeLogLikelihood;
+      var solution = CreateGaussianProcessSolution(problemData, hyp, MeanFunction, CovarianceFunction,
+        out negativeLogLikelihood, out trainR2, out testR2);
+
+      Results.Add(new Result("Gaussian process regression solution", "The Gaussian process regression solution.", solution));
+      Results.Add(new Result("Training R²", "The Pearson's R² of the Gaussian process solution on the training partition.", new DoubleValue(trainR2)));
+      Results.Add(new Result("Test R²", "The Pearson's R² of the Gaussian process solution on the test partition.", new DoubleValue(testR2)));
+      Results.Add(new Result("Negative log likelihood", "The negative log likelihood of the Gaussian process.", new DoubleValue(negativeLogLikelihood)));
+    }
+
+    public static GaussianProcessRegressionSolution CreateGaussianProcessSolution(IRegressionProblemData problemData,
+      IEnumerable<double> hyp, IMeanFunction mean, ICovarianceFunction cov,
+      out double negativeLogLikelihood, out double trainingR2, out double testR2) {
+
+      Dataset dataset = problemData.Dataset;
+      var allowedInputVariables = problemData.AllowedInputVariables;
+      string targetVariable = problemData.TargetVariable;
+      IEnumerable<int> rows = problemData.TrainingIndices;
+
+      var model = new GaussianProcessModel(dataset, targetVariable, allowedInputVariables, rows, hyp, mean, cov);
+      var solution = new GaussianProcessRegressionSolution(model, (IRegressionProblemData)problemData.Clone());
+      negativeLogLikelihood = model.NegativeLogLikelihood;
+      trainingR2 = solution.TrainingRSquared;
+      testR2 = solution.TestRSquared;
+      return solution;
+    }
+
+    private static void OptimizeGaussianProcessParameters(double[] hyp, ref double func, double[] grad, object obj) {
+      var objArr = (object[])obj;
+      var meanFunction = (IMeanFunction)objArr[0];
+      var covarianceFunction = (ICovarianceFunction)objArr[1];
+      var problemData = (RegressionProblemData)objArr[2];
+      IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
+
+      Dataset ds = problemData.Dataset;
+      string targetVariable = problemData.TargetVariable;
+      IEnumerable<int> rows = problemData.TrainingIndices;
+
+
+      IEnumerable<double> dHyp;
+      var model = new GaussianProcessModel(ds, targetVariable, allowedInputVariables, rows, hyp, meanFunction,
+                                           covarianceFunction);
+      dHyp = model.GetHyperparameterGradients();
+
+      int i = 0;
+      foreach (var e in dHyp) {
+        grad[i++] = e;
+      }
+      func = model.NegativeLogLikelihood;
+    }
+
+    public void Report(double[] arg, double func, object obj) {
+      if (!Results.ContainsKey(NegativeLogLikelihoodTableParameterName)) {
+        Results.Add(new Result(NegativeLogLikelihoodTableParameterName, new DataTable()));
+      }
+      if (!Results.ContainsKey(HyperParametersTableParameterName)) {
+        Results.Add(new Result(HyperParametersTableParameterName, new DataTable()));
+      }
+
+      var nllTable = (DataTable)Results[NegativeLogLikelihoodTableParameterName].Value;
+      if (!nllTable.Rows.ContainsKey("Negative log likelihood"))
+        nllTable.Rows.Add(new DataRow("Negative log likelihood"));
+      var nllRow = nllTable.Rows["Negative log likelihood"];
+
+      nllRow.Values.Add(func);
+
+      var hypTable = (DataTable)Results[HyperParametersTableParameterName].Value;
+      if (hypTable.Rows.Count == 0) {
+        for (int i = 0; i < arg.Length; i++)
+          hypTable.Rows.Add(new DataRow(i.ToString()));
+      }
+      for (int i = 0; i < arg.Length; i++) {
+        hypTable.Rows[i.ToString()].Values.Add(arg[i]);
+      }
+    }
+
+    #endregion
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs	(revision 8323)
@@ -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.GaussianProcess {
+  /// <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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs	(revision 8323)
@@ -0,0 +1,15 @@
+﻿
+
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  public interface ICovarianceFunction : IItem {
+    int GetNumberOfParameters(int numberOfVariables);
+    void SetParameter(double[] hyp, double[,] x);
+    void SetParameter(double[] hyp, double[,] x, double[,] xt);
+
+    double GetCovariance(int i, int j);
+    double[] GetDiagonalCovariances();
+    double[] GetGradient(int i, int j);
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/IMeanFunction.cs	(revision 8323)
@@ -0,0 +1,11 @@
+﻿
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  public interface IMeanFunction : IItem {
+    int GetNumberOfParameters(int numberOfVariables);
+    void SetParameter(double[] hyp, double[,] x);
+    double[] GetMean();
+    double[] GetGradients(int k);
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanConst.cs	(revision 8323)
@@ -0,0 +1,49 @@
+﻿
+using System;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  [StorableClass]
+  [Item(Name = "MeanConst", Description = "Constant mean function for Gaussian processes.")]
+  public class MeanConst : Item, IMeanFunction {
+    [Storable]
+    private double c;
+    [Storable]
+    private int n;
+    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;
+      this.n = original.n;
+    }
+    public MeanConst()
+      : base() {
+    }
+
+    public void SetParameter(double[] hyp, double[,] x) {
+      if (hyp.Length != 1) throw new ArgumentException("Only one hyper-parameter allowed for constant mean function.", "hyp");
+      this.c = hyp[0];
+      this.n = x.GetLength(0);
+    }
+
+    public double[] GetMean() {
+      return Enumerable.Repeat(c, n).ToArray();
+    }
+
+    public double[] GetGradients(int k) {
+      if (k > 0) throw new ArgumentException();
+      return Enumerable.Repeat(1.0, n).ToArray();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MeanConst(this, cloner);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/MeanZero.cs	(revision 8323)
@@ -0,0 +1,43 @@
+﻿
+using System;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  [StorableClass]
+  [Item(Name = "MeanZero", Description = "Constant zero mean function for Gaussian processes.")]
+  public class MeanZero : Item, IMeanFunction {
+    [Storable]
+    private int n;
+    public int GetNumberOfParameters(int numberOfVariables) {
+      return 0;
+    }
+    [StorableConstructor]
+    protected MeanZero(bool deserializing) : base(deserializing) { }
+    protected MeanZero(MeanZero original, Cloner cloner)
+      : base(original, cloner) {
+      this.n = original.n;
+    }
+    public MeanZero() {
+    }
+
+    public void SetParameter(double[] hyp, double[,] x) {
+      if (hyp.Length > 0) throw new ArgumentException("No hyper-parameters allowed for zero mean function.", "hyp");
+      this.n = x.GetLength(0);
+    }
+
+    public double[] GetMean() {
+      return Enumerable.Repeat(0.0, n).ToArray();
+    }
+
+    public double[] GetGradients(int k) {
+      if (k > 0) throw new ArgumentException();
+      return Enumerable.Repeat(0.0, n).ToArray();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MeanZero(this, cloner);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/Util.cs	(revision 8323)
@@ -0,0 +1,27 @@
+﻿
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  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 Math.Max(x.Zip(y, (a, b) => (a - b) * (a - b)).Sum(), 0);
+    }
+
+    public static IEnumerable<double> GetRow(double[,] x, int r) {
+      int cols = x.GetLength(1);
+      return Enumerable.Range(0, cols).Select(c => x[r, c]);
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8322)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8323)
@@ -122,4 +122,16 @@
     </Compile>
     <Compile Include="FixedDataAnalysisAlgorithm.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 +156,5 @@
     </Compile>
     <Compile Include="Linear\AlglibUtil.cs" />
+    <Compile Include="Linear\Scaling.cs" />
     <Compile Include="Linear\LinearDiscriminantAnalysis.cs" />
     <Compile Include="Linear\LinearRegression.cs">
@@ -187,4 +200,8 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
+      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
+      <Name>HeuristicLab.Analysis-3.3</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
@@ -261,4 +278,8 @@
       <Name>HeuristicLab.Problems.Instances-3.3</Name>
       <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
+      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
+      <Name>HeuristicLab.Random-3.3</Name>
     </ProjectReference>
   </ItemGroup>
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8323)
@@ -0,0 +1,35 @@
+#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.Collections.Generic;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Algorithms.DataAnalysis.GaussianProcess {
+  /// <summary>
+  /// Interface to represent a Gaussian process posterior
+  /// </summary>
+  public interface IGaussianProcessModel : IDataAnalysisModel, IRegressionModel {
+    double NegativeLogLikelihood { get; }
+    IMeanFunction MeanFunction { get; }
+    ICovarianceFunction CovarianceFunction { get; }
+    IEnumerable<double> Hyperparameters { get; }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs	(revision 8323)
@@ -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.GaussianProcess {
+  /// <summary>
+  /// Interface to represent a Gaussian process solution (either regression or classification)
+  /// </summary>
+  public interface IGaussianProcessSolution : IDataAnalysisSolution {
+    new IGaussianProcessModel Model { get; }
+  }
+}
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs	(revision 8322)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs	(revision 8323)
@@ -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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/Scaling.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/Scaling.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/Scaling.cs	(revision 8323)
@@ -0,0 +1,61 @@
+﻿#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]
+  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: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame	(revision 8322)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame	(revision 8323)
@@ -28,4 +28,5 @@
   [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.Analysis", "3.3.0")]
   [PluginDependency("HeuristicLab.ALGLIB", "3.5.0")]
   [PluginDependency("HeuristicLab.LibSVM", "1.6.3")]
@@ -43,4 +44,5 @@
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification", "3.4")]
   [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")]
+  [PluginDependency("HeuristicLab.Random", "3.3.0")]
   public class HeuristicLabAlgorithmsDataAnalysisPlugin : PluginBase {
   }
Index: /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs
===================================================================
--- /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs	(revision 8322)
+++ /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs	(revision 8323)
@@ -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: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj	(revision 8322)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj	(revision 8323)
@@ -119,4 +119,5 @@
     <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveMeanAbsoluteErrorEvaluator.cs" />
     <Compile Include="SingleObjective\Evaluators\SymbolicRegressionConstantOptimizationEvaluator.cs" />
+    <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveWeightedAbsoluteErrorEvaluator.cs" />
     <Compile Include="SingleObjective\SymbolicRegressionSingleObjectiveOverfittingAnalyzer.cs" />
     <Compile Include="SymbolicRegressionModel.cs" />
@@ -164,5 +165,4 @@
       <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
       <Name>HeuristicLab.Analysis-3.3</Name>
-      <Private>False</Private>
     </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
Index: /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/GaussianProcessRegressionTest.cs
===================================================================
--- /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/GaussianProcessRegressionTest.cs	(revision 8323)
+++ /trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/GaussianProcessRegressionTest.cs	(revision 8323)
@@ -0,0 +1,108 @@
+﻿#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 System.Threading;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Algorithms.DataAnalysis.GaussianProcess;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Problems.DataAnalysis;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab_33.Tests {
+  [TestClass]
+  public class GaussianProcessRegressionTest {
+    public GaussianProcessRegressionTest() { }
+
+    private TestContext testContextInstance;
+
+    /// <summary>
+    ///Gets or sets the test context which provides
+    ///information about and functionality for the current test run.
+    ///</summary>
+    public TestContext TestContext {
+      get {
+        return testContextInstance;
+      }
+      set {
+        testContextInstance = value;
+      }
+    }
+
+    private EventWaitHandle trigger = new AutoResetEvent(false);
+    private Exception ex;
+
+    [TestMethod]
+    public void GaussianProcessRegressionPerformanceTest() {
+      ex = null;
+
+      var cv = new CrossValidation();
+      cv.Algorithm = new GaussianProcessRegression();
+      var rand = new HeuristicLab.Random.MersenneTwister();
+      double[,] data = GenerateData(100, rand);
+      List<string> variables = new List<string>() { "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "y" };
+      Dataset ds = new Dataset(variables, data);
+      cv.Problem.ProblemDataParameter.ActualValue = new RegressionProblemData(ds, variables.Take(10), variables.Last());
+      cv.Folds.Value = 5;
+      cv.SamplesStart.Value = 0;
+      cv.SamplesEnd.Value = 99;
+
+      cv.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(cv_ExceptionOccurred);
+      cv.Stopped += new EventHandler(cv_Stopped);
+
+      cv.Prepare();
+      cv.Start();
+      trigger.WaitOne();
+      if (ex != null) throw ex;
+
+      TestContext.WriteLine("Runtime: {0}", cv.ExecutionTime.ToString());
+
+    }
+
+    // poly-10: y = x1 x2 + x3 x4 + x5 x6 + x1 x7 x9 + x3 x6 x10
+    private double[,] GenerateData(int n, IRandom random) {
+      double[,] data = new double[n, 11];
+      for (int i = 0; i < n; i++) {
+        for (int c = 0; c < 10; c++) {
+          data[i, c] = random.NextDouble() * 2.0 - 1.0;
+        }
+        data[i, 10] =
+          data[i, 0] * data[i, 1] +
+          data[i, 2] * data[i, 3] +
+          data[i, 4] * data[i, 5] +
+          data[i, 0] * data[i, 6] * data[i, 8] +
+          data[i, 2] * data[i, 5] * data[i, 9];
+      }
+      return data;
+    }
+
+    private void cv_ExceptionOccurred(object sender, EventArgs<Exception> e) {
+      ex = e.Value;
+    }
+
+    private void cv_Stopped(object sender, EventArgs e) {
+      trigger.Set();
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 8322)
+++ /trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj	(revision 8323)
@@ -279,4 +279,5 @@
     <Compile Include="HeuristicLab-3.3\ContentViewTests.cs" />
     <Compile Include="HeuristicLab-3.3\ParameterVisibilityTest.cs" />
+    <Compile Include="HeuristicLab-3.3\GaussianProcessRegressionTest.cs" />
     <Compile Include="HeuristicLab-3.3\DeepCloneableCloningTest.cs" />
     <Compile Include="HeuristicLab-3.3\GeneticAlgorithmTest.cs" />
