Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessModelView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessModelView.Designer.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessModelView.Designer.cs	(revision 8582)
@@ -19,4 +19,6 @@
  */
 #endregion
+
+using HeuristicLab.Optimization.Views;
 
 namespace HeuristicLab.Algorithms.DataAnalysis.Views {
@@ -45,5 +47,14 @@
     /// </summary>
     private void InitializeComponent() {
+      this.resultCollectionView = new ResultCollectionView();
       this.SuspendLayout();
+      // 
+      // resultCollectionView
+      // 
+      this.resultCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.resultCollectionView.Location = new System.Drawing.Point(0, 0);
+      this.resultCollectionView.Name = "resultCollectionView";
+      this.resultCollectionView.Size = new System.Drawing.Size(253, 251);
+      this.resultCollectionView.TabIndex = 0;
       // 
       // GaussianProcessModelView
@@ -51,4 +62,5 @@
       this.AllowDrop = true;
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+      this.Controls.Add(this.resultCollectionView);
       this.Name = "GaussianProcessModelView";
       this.Size = new System.Drawing.Size(253, 251);
@@ -59,5 +71,5 @@
     #endregion
 
-
+    private ResultCollectionView resultCollectionView;
 
   }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessModelView.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessModelView.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessModelView.cs	(revision 8582)
@@ -21,6 +21,8 @@
 
 using System.Windows.Forms;
+using HeuristicLab.Data;
 using HeuristicLab.MainForm;
 using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Optimization;
 
 namespace HeuristicLab.Algorithms.DataAnalysis.Views {
@@ -31,5 +33,7 @@
     public new IGaussianProcessModel Content {
       get { return (IGaussianProcessModel)base.Content; }
-      set { base.Content = value; }
+      set {
+        base.Content = value;
+      }
     }
 
@@ -43,7 +47,16 @@
       if (Content == null) {
         // clear
+        resultCollectionView.Content = null;
       } else {
-        // update
+        resultCollectionView.Content = CreateResultCollection(Content);
       }
+    }
+
+    private ResultCollection CreateResultCollection(IGaussianProcessModel gaussianProcessModel) {
+      var res = new ResultCollection();
+      res.Add(new Result("Mean Function", gaussianProcessModel.MeanFunction));
+      res.Add(new Result("Covariance Function", gaussianProcessModel.CovarianceFunction));
+      res.Add(new Result("Noise sigma", new DoubleValue(gaussianProcessModel.SigmaNoise)));
+      return res;
     }
   }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceConst.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceConst.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceConst.cs	(revision 8582)
@@ -24,4 +24,5 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -30,8 +31,15 @@
   [Item(Name = "CovarianceConst",
     Description = "Constant covariance function for Gaussian processes.")]
-  public class CovarianceConst : Item, ICovarianceFunction {
+  public class CovarianceConst : CovarianceFunction {
+
+    public IValueParameter<DoubleValue> ScaleParameter {
+      get { return scaleParameter; }
+    }
+
     [Storable]
-    private double sf2;
-    public double Scale { get { return sf2; } }
+    private readonly HyperParameter<DoubleValue> scaleParameter;
+
+    [Storable]
+    private double scale;
 
     [StorableConstructor]
@@ -42,10 +50,27 @@
     protected CovarianceConst(CovarianceConst original, Cloner cloner)
       : base(original, cloner) {
-      this.sf2 = original.sf2;
+      this.scaleParameter = cloner.Clone(original.scaleParameter);
+      this.scale = original.scale;
+
+      RegisterEvents();
     }
 
     public CovarianceConst()
       : base() {
+      scaleParameter = new HyperParameter<DoubleValue>("Scale", "The scale of the constant covariance function.");
+      Parameters.Add(scaleParameter);
+      RegisterEvents();
     }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterEvents();
+    }
+
+    // caching
+    private void RegisterEvents() {
+      AttachValueChangeHandler<DoubleValue, double>(scaleParameter, () => { scale = scaleParameter.Value.Value; });
+    }
+
 
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -53,24 +78,26 @@
     }
 
-    public int GetNumberOfParameters(int numberOfVariables) {
-      return 1;
+    public override int GetNumberOfParameters(int numberOfVariables) {
+      return scaleParameter.Fixed ? 0 : 1;
     }
 
-    public void SetParameter(double[] hyp) {
-      if (hyp.Length != 1) throw new ArgumentException("CovarianceConst has only one hyperparameter", "k");
-      this.sf2 = Math.Exp(2 * hyp[0]);
+    public override void SetParameter(double[] hyp) {
+      if (!scaleParameter.Fixed && hyp.Length == 1) {
+        scaleParameter.SetValue(new DoubleValue(Math.Exp(2 * hyp[0])));
+      } else {
+        throw new ArgumentException("The length of the parameter vector does not match the number of free parameters for CovarianceConst", "hyp");
+      }
     }
 
-
-    public double GetCovariance(double[,] x, int i, int j) {
-      return sf2;
+    public override double GetCovariance(double[,] x, int i, int j) {
+      return scale;
     }
 
-    public IEnumerable<double> GetGradient(double[,] x, int i, int j) {
-      yield return 2 * sf2;
+    public override IEnumerable<double> GetGradient(double[,] x, int i, int j) {
+      yield return 2.0 * scale;
     }
 
-    public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
-      return sf2;
+    public override double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
+      return scale;
     }
   }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunction.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunction.cs	(revision 8582)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunction.cs	(revision 8582)
@@ -0,0 +1,98 @@
+﻿#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  // base class for covariance functions
+  public abstract class CovarianceFunction : ParameterizedNamedItem, ICovarianceFunction {
+    [StorableConstructor]
+    protected CovarianceFunction(bool deserializing)
+      : base(deserializing) {
+    }
+
+    protected CovarianceFunction(CovarianceFunction original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    protected CovarianceFunction()
+      : base() {
+      Name = ItemName;
+      Description = ItemDescription;
+    }
+
+    protected void SetNullableDoubleParameter(IValueParameter<DoubleValue> parameter, double? value) {
+      if (value.HasValue) {
+        parameter.Value = new DoubleValue(value.Value);
+      } else {
+        parameter.Value = null;
+      }
+    }
+
+    protected double? GetNullableDoubleParameter(IValueParameter<DoubleValue> parameter) {
+      return parameter.Value == null ? (double?)null : parameter.Value.Value;
+    }
+
+    protected void AttachValueChangeHandler<T, U>(IValueParameter<T> parameter, Action action)
+      where T : ValueTypeValue<U>
+      where U : struct {
+      parameter.ValueChanged += (sender, args) => {
+        if (parameter.Value != null) {
+          parameter.Value.ValueChanged += (s, a) => action();
+          action();
+        }
+      };
+      if (parameter.Value != null) {
+        parameter.Value.ValueChanged += (s, a) => action();
+      }
+    }
+
+    protected void AttachArrayChangeHandler<T, U>(IValueParameter<T> parameter, Action action)
+      where T : ValueTypeArray<U>
+      where U : struct {
+      parameter.ValueChanged += (sender, args) => {
+        if (parameter.Value != null) {
+          parameter.Value.ItemChanged += (s, a) => action();
+          parameter.Value.Reset += (s, a) => action();
+          action();
+        }
+      };
+      if (parameter.Value != null) {
+        parameter.Value.ItemChanged += (s, a) => action();
+        parameter.Value.Reset += (s, a) => action();
+      }
+
+    }
+
+    public abstract int GetNumberOfParameters(int numberOfVariables);
+    public abstract void SetParameter(double[] hyp);
+    public abstract double GetCovariance(double[,] x, int i, int j);
+    public abstract IEnumerable<double> GetGradient(double[,] x, int i, int j);
+    public abstract double GetCrossCovariance(double[,] x, double[,] xt, int i, int j);
+
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinear.cs	(revision 8582)
@@ -29,6 +29,6 @@
   [StorableClass]
   [Item(Name = "CovarianceLinear", Description = "Linear covariance function for Gaussian processes.")]
-  public class CovarianceLinear : Item, ICovarianceFunction {
-    public int GetNumberOfParameters(int numberOfVariables) {
+  public class CovarianceLinear : CovarianceFunction {
+    public override int GetNumberOfParameters(int numberOfVariables) {
       return 0;
     }
@@ -46,17 +46,17 @@
     }
 
-    public void SetParameter(double[] hyp) {
+    public override void SetParameter(double[] hyp) {
       if (hyp.Length > 0) throw new ArgumentException("No hyperparameters are allowed for the linear covariance function.");
     }
 
-    public double GetCovariance(double[,] x, int i, int j) {
+    public override double GetCovariance(double[,] x, int i, int j) {
       return Util.ScalarProd(x, i, j);
     }
 
-    public IEnumerable<double> GetGradient(double[,] x, int i, int j) {
+    public override IEnumerable<double> GetGradient(double[,] x, int i, int j) {
       yield break;
     }
 
-    public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
+    public override double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
       return Util.ScalarProd(x, i, xt, j);
     }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinearArd.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinearArd.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceLinearArd.cs	(revision 8582)
@@ -25,4 +25,5 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -31,19 +32,14 @@
   [Item(Name = "CovarianceLinearArd",
     Description = "Linear covariance function with automatic relevance determination for Gaussian processes.")]
-  public class CovarianceLinearArd : Item, ICovarianceFunction {
+  public class CovarianceLinearArd : CovarianceFunction {
+    public IValueParameter<DoubleArray> InverseLengthParameter {
+      get { return inverseLengthParameter; }
+    }
+
+    [Storable]
+    private HyperParameter<DoubleArray> inverseLengthParameter;
+
     [Storable]
     private double[] inverseLength;
-    public double[] InverseLength {
-      get {
-        if (inverseLength == null) return null;
-        double[] res = new double[inverseLength.Length];
-        Array.Copy(inverseLength, res, res.Length);
-        return res;
-      }
-    }
-
-    public int GetNumberOfParameters(int numberOfVariables) {
-      return numberOfVariables;
-    }
 
     [StorableConstructor]
@@ -51,8 +47,23 @@
     protected CovarianceLinearArd(CovarianceLinearArd original, Cloner cloner)
       : base(original, cloner) {
-      this.inverseLength = original.InverseLength;  // array is copied in the getter
+      inverseLengthParameter = cloner.Clone(original.inverseLengthParameter);
+      if (original.inverseLength != null) {
+        this.inverseLength = new double[original.inverseLength.Length];
+        Array.Copy(original.inverseLength, inverseLength, inverseLength.Length);
+      }
+
+      RegisterEvents();
     }
     public CovarianceLinearArd()
       : base() {
+      inverseLengthParameter = new HyperParameter<DoubleArray>("InverseLength",
+                                                               "The inverse length parameter for ARD.");
+      Parameters.Add(inverseLengthParameter);
+      RegisterEvents();
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterEvents();
     }
 
@@ -61,13 +72,28 @@
     }
 
-    public void SetParameter(double[] hyp) {
-      inverseLength = hyp.Select(e => 1.0 / Math.Exp(e)).ToArray();
+    // caching
+    private void RegisterEvents() {
+      AttachArrayChangeHandler<DoubleArray, double>(inverseLengthParameter, () => { inverseLength = inverseLengthParameter.Value.ToArray(); });
     }
 
-    public double GetCovariance(double[,] x, int i, int j) {
+
+    public override int GetNumberOfParameters(int numberOfVariables) {
+      if (!inverseLengthParameter.Fixed)
+        return numberOfVariables;
+      else
+        return 0;
+    }
+
+    public override void SetParameter(double[] hyp) {
+      if (!inverseLengthParameter.Fixed && hyp.Length > 0) {
+        inverseLengthParameter.SetValue(new DoubleArray(hyp.Select(e => 1.0 / Math.Exp(e)).ToArray()));
+      } else throw new ArgumentException("The length of the parameter vector does not match the number of free parameters for CovarianceLinearArd", "hyp");
+    }
+
+    public override double GetCovariance(double[,] x, int i, int j) {
       return Util.ScalarProd(x, i, j, inverseLength);
     }
 
-    public IEnumerable<double> GetGradient(double[,] x, int i, int j) {
+    public override IEnumerable<double> GetGradient(double[,] x, int i, int j) {
       for (int k = 0; k < inverseLength.Length; k++) {
         yield return -2.0 * x[i, k] * x[j, k] * inverseLength[k] * inverseLength[k];
@@ -75,5 +101,5 @@
     }
 
-    public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
+    public override double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
       return Util.ScalarProd(x, i, xt, j, inverseLength);
     }
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceMaternIso.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceMaternIso.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceMaternIso.cs	(revision 8582)
@@ -22,6 +22,9 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -30,20 +33,28 @@
   [Item(Name = "CovarianceMaternIso",
     Description = "Matern covariance function for Gaussian processes.")]
-  public class CovarianceMaternIso : Item, ICovarianceFunction {
+  public class CovarianceMaternIso : CovarianceFunction {
+    public IValueParameter<DoubleValue> ScaleParameter {
+      get { return scaleParameter; }
+    }
+    public IValueParameter<DoubleValue> InverseLengthParameter {
+      get { return inverseLengthParameter; }
+    }
+    public IConstrainedValueParameter<IntValue> DParameter {
+      get { return dParameter; }
+    }
+
+    [Storable]
+    private readonly HyperParameter<DoubleValue> inverseLengthParameter;
+    [Storable]
+    private readonly HyperParameter<DoubleValue> scaleParameter;
+    [Storable]
+    private readonly ConstrainedValueParameter<IntValue> dParameter;
+
+    [Storable]
+    private double inverseLength;
     [Storable]
     private double sf2;
-    public double Scale { get { return sf2; } }
-    [Storable]
-    private double inverseLength;
-    public double InverseLength { get { return inverseLength; } }
     [Storable]
     private int d;
-    public int D {
-      get { return d; }
-      set {
-        if (value == 1 || value == 3 || value == 5) d = value;
-        else throw new ArgumentException("D can only take the values 1, 3, or 5");
-      }
-    }
 
     [StorableConstructor]
@@ -54,12 +65,33 @@
     protected CovarianceMaternIso(CovarianceMaternIso original, Cloner cloner)
       : base(original, cloner) {
+      this.scaleParameter = cloner.Clone(original.scaleParameter);
       this.sf2 = original.sf2;
+      this.inverseLengthParameter = cloner.Clone(original.inverseLengthParameter);
       this.inverseLength = original.inverseLength;
+      this.dParameter = cloner.Clone(original.dParameter);
       this.d = original.d;
+      RegisterEvents();
     }
 
     public CovarianceMaternIso()
       : base() {
-      d = 1;
+      inverseLengthParameter = new HyperParameter<DoubleValue>("InverseLength", "The inverse length parameter of the isometric Matern covariance function.");
+      scaleParameter = new HyperParameter<DoubleValue>("Scale", "The scale parameter of the isometric Matern covariance function.");
+      var validDValues = new ItemSet<IntValue>();
+      validDValues.Add((IntValue)new IntValue(1).AsReadOnly());
+      validDValues.Add((IntValue)new IntValue(3).AsReadOnly());
+      validDValues.Add((IntValue)new IntValue(5).AsReadOnly());
+      dParameter = new ConstrainedValueParameter<IntValue>("D", "The d parameter (allowed values: 1, 3, or 5) of the isometric Matern covariance function.", validDValues, validDValues.First());
+
+      Parameters.Add(inverseLengthParameter);
+      Parameters.Add(scaleParameter);
+      Parameters.Add(dParameter);
+
+      RegisterEvents();
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterEvents();
     }
 
@@ -68,12 +100,28 @@
     }
 
-    public int GetNumberOfParameters(int numberOfVariables) {
-      return 2;
+    // caching
+    private void RegisterEvents() {
+      AttachValueChangeHandler<DoubleValue, double>(inverseLengthParameter, () => { inverseLength = inverseLengthParameter.Value.Value; });
+      AttachValueChangeHandler<DoubleValue, double>(scaleParameter, () => { sf2 = scaleParameter.Value.Value; });
+      AttachValueChangeHandler<IntValue, int>(dParameter, () => { d = dParameter.Value.Value; });
     }
 
-    public void SetParameter(double[] hyp) {
-      if (hyp.Length != 2) throw new ArgumentException("CovarianceMaternIso has two hyperparameters", "hyp");
-      this.inverseLength = 1.0 / Math.Exp(hyp[0]);
-      this.sf2 = Math.Exp(2 * hyp[1]);
+    public override int GetNumberOfParameters(int numberOfVariables) {
+      return
+        (inverseLengthParameter.Fixed ? 0 : 1) +
+        (scaleParameter.Fixed ? 0 : 1);
+    }
+
+    public override void SetParameter(double[] hyp) {
+      int i = 0;
+      if (!inverseLengthParameter.Fixed) {
+        inverseLengthParameter.SetValue(new DoubleValue(1.0 / Math.Exp(hyp[i])));
+        i++;
+      }
+      if (!scaleParameter.Fixed) {
+        scaleParameter.SetValue(new DoubleValue(Math.Exp(2 * hyp[i])));
+        i++;
+      }
+      if (hyp.Length != i) throw new ArgumentException("The length of the parameter vector does not match the number of free parameters for CovarianceMaternIso", "hyp");
     }
 
@@ -101,5 +149,5 @@
     }
 
-    public double GetCovariance(double[,] x, int i, int j) {
+    public override double GetCovariance(double[,] x, int i, int j) {
       double dist = i == j
                    ? 0.0
@@ -108,5 +156,5 @@
     }
 
-    public IEnumerable<double> GetGradient(double[,] x, int i, int j) {
+    public override IEnumerable<double> GetGradient(double[,] x, int i, int j) {
       double dist = i == j
                    ? 0.0
@@ -117,5 +165,5 @@
     }
 
-    public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
+    public override double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
       double dist = Math.Sqrt(Util.SqrDist(x, i, xt, j, Math.Sqrt(d) * inverseLength));
       return sf2 * m(dist);
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovariancePeriodic.cs	(revision 8582)
@@ -22,6 +22,8 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -29,28 +31,59 @@
   [StorableClass]
   [Item(Name = "CovariancePeriodic", Description = "Periodic covariance function for Gaussian processes.")]
-  public class CovariancePeriodic : Item, ICovarianceFunction {
+  public class CovariancePeriodic : CovarianceFunction {
+    public IValueParameter<DoubleValue> ScaleParameter {
+      get { return scaleParameter; }
+    }
+    public IValueParameter<DoubleValue> InverseLengthParameter {
+      get { return inverseLengthParameter; }
+    }
+    public IValueParameter<DoubleValue> PeriodParameter {
+      get { return periodParameter; }
+    }
+
     [Storable]
-    private double sf2;
-    public double Scale { get { return sf2; } }
+    private HyperParameter<DoubleValue> scaleParameter;
+    [Storable]
+    private HyperParameter<DoubleValue> inverseLengthParameter;
+    [Storable]
+    private HyperParameter<DoubleValue> periodParameter;
+
+    [Storable]
+    private double scale;
     [Storable]
     private double inverseLength;
-    public double InverseLength { get { return inverseLength; } }
     [Storable]
-    private double p;
-    public double Period { get { return p; } }
+    private double period;
 
-    public int GetNumberOfParameters(int numberOfVariables) {
-      return 3;
-    }
+
     [StorableConstructor]
     protected CovariancePeriodic(bool deserializing) : base(deserializing) { }
     protected CovariancePeriodic(CovariancePeriodic original, Cloner cloner)
       : base(original, cloner) {
-      sf2 = original.sf2;
-      inverseLength = original.inverseLength;
-      p = original.p;
+      this.scaleParameter = cloner.Clone(original.scaleParameter);
+      this.inverseLengthParameter = cloner.Clone(original.inverseLengthParameter);
+      this.periodParameter = cloner.Clone(original.periodParameter);
+      this.scale = original.scale;
+      this.inverseLength = original.inverseLength;
+      this.period = original.period;
+
+      RegisterEvents();
     }
+
     public CovariancePeriodic()
       : base() {
+      scaleParameter = new HyperParameter<DoubleValue>("Scale", "The scale of the periodic covariance function.");
+      inverseLengthParameter = new HyperParameter<DoubleValue>("InverseLength", "The inverse length parameter for the periodic covariance function.");
+      periodParameter = new HyperParameter<DoubleValue>("Period", "The period parameter for the periodic covariance function.");
+      Parameters.Add(scaleParameter);
+      Parameters.Add(inverseLengthParameter);
+      Parameters.Add(periodParameter);
+
+      RegisterEvents();
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      RegisterEvents();
     }
 
@@ -59,37 +92,59 @@
     }
 
-    public void SetParameter(double[] hyp) {
-      if (hyp.Length != 3) throw new ArgumentException();
-      this.inverseLength = 1.0 / Math.Exp(hyp[0]);
-      this.p = Math.Exp(hyp[1]);
-      this.sf2 = Math.Exp(2 * hyp[2]);
+    // caching
+    private void RegisterEvents() {
+      AttachValueChangeHandler<DoubleValue, double>(scaleParameter, () => { scale = scaleParameter.Value.Value; });
+      AttachValueChangeHandler<DoubleValue, double>(inverseLengthParameter, () => { inverseLength = inverseLengthParameter.Value.Value; });
+      AttachValueChangeHandler<DoubleValue, double>(periodParameter, () => { period = periodParameter.Value.Value; });
     }
 
-    public double GetCovariance(double[,] x, int i, int j) {
+    public override int GetNumberOfParameters(int numberOfVariables) {
+      return
+        (new[] { scaleParameter, inverseLengthParameter, periodParameter }).Count(p => !p.Fixed);
+    }
+
+    public override void SetParameter(double[] hyp) {
+      int i = 0;
+      if (!inverseLengthParameter.Fixed) {
+        inverseLengthParameter.SetValue(new DoubleValue(1.0 / Math.Exp(hyp[i])));
+        i++;
+      }
+      if (!periodParameter.Fixed) {
+        periodParameter.SetValue(new DoubleValue(Math.Exp(hyp[i])));
+        i++;
+      }
+      if (!scaleParameter.Fixed) {
+        scaleParameter.SetValue(new DoubleValue(Math.Exp(2 * hyp[i])));
+        i++;
+      }
+      if (hyp.Length != i) throw new ArgumentException("The length of the parameter vector does not match the number of free parameters for CovariancePeriod", "hyp");
+    }
+
+    public override double GetCovariance(double[,] x, int i, int j) {
       double k = i == j ? 0.0 : GetDistance(x, x, i, j);
-      k = Math.PI * k / p;
+      k = Math.PI * k / period;
       k = Math.Sin(k) * inverseLength;
       k = k * k;
 
-      return sf2 * Math.Exp(-2.0 * k);
+      return scale * Math.Exp(-2.0 * k);
     }
 
-    public IEnumerable<double> GetGradient(double[,] x, int i, int j) {
-      double v = i == j ? 0.0 : Math.PI * GetDistance(x, x, i, j) / p;
+    public override IEnumerable<double> GetGradient(double[,] x, int i, int j) {
+      double v = i == j ? 0.0 : Math.PI * GetDistance(x, x, i, j) / period;
       double gradient = Math.Sin(v) * inverseLength;
       gradient *= gradient;
-      yield return 4.0 * sf2 * Math.Exp(-2.0 * gradient) * gradient;
+      yield return 4.0 * scale * Math.Exp(-2.0 * gradient) * gradient;
       double r = Math.Sin(v) * inverseLength;
-      yield return 4.0 * sf2 * inverseLength * Math.Exp(-2 * r * r) * r * Math.Cos(v) * v;
-      yield return 2.0 * sf2 * Math.Exp(-2 * gradient);
+      yield return 4.0 * scale * inverseLength * Math.Exp(-2 * r * r) * r * Math.Cos(v) * v;
+      yield return 2.0 * scale * Math.Exp(-2 * gradient);
     }
 
-    public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
+    public override double GetCrossCovariance(double[,] x, double[,] xt, int i, int j) {
       double k = GetDistance(x, xt, i, j);
-      k = Math.PI * k / p;
+      k = Math.PI * k / period;
       k = Math.Sin(k) * inverseLength;
       k = k * k;
 
-      return sf2 * Math.Exp(-2.0 * k);
+      return scale * Math.Exp(-2.0 * k);
     }
 
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs	(revision 8582)
@@ -76,4 +76,7 @@
     [Storable]
     private double sqrSigmaNoise;
+    public double SigmaNoise {
+      get { return Math.Sqrt(sqrSigmaNoise); }
+    }
 
     [Storable]
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/HyperParameter.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/HyperParameter.cs	(revision 8582)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/HyperParameter.cs	(revision 8582)
@@ -0,0 +1,70 @@
+﻿#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.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.DataAnalysis {
+  [StorableClass]
+  [Item(Name = "HyperParameter", Description = "Represents a hyperparameter for Gaussian processes.")]
+  public class HyperParameter<T> : OptionalValueParameter<T>, IValueParameter<T> where T : class, IItem {
+
+    [Storable]
+    private bool @fixed = false;
+    public bool Fixed {
+      get { return @fixed; }
+    }
+
+    [StorableConstructor]
+    protected HyperParameter(bool deserializing) : base(deserializing) { }
+    protected HyperParameter(HyperParameter<T> original, Cloner cloner)
+      : base(original, cloner) {
+      this.@fixed = original.@fixed;
+    }
+    public HyperParameter(string name, string description)
+      : base(name, description) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new HyperParameter<T>(this, cloner);
+    }
+
+    // if a value is set through this property then we fix the value of the hyperparameter 
+    public override T Value {
+      get {
+        return base.Value;
+      }
+      set {
+        base.Value = value;
+        @fixed = value != null;
+      }
+    }
+
+    // in the optimization we are allowed to set the value of non-fixed parameters
+    public void SetValue(T value) {
+      if (@fixed) throw new InvalidOperationException("Can't set the value of a fixed hyperparameter");
+      base.Value = value;
+    }
+  }
+}
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 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj	(revision 8582)
@@ -120,4 +120,6 @@
     </Compile>
     <Compile Include="FixedDataAnalysisAlgorithm.cs" />
+    <Compile Include="GaussianProcess\HyperParameter.cs" />
+    <Compile Include="GaussianProcess\CovarianceFunction.cs" />
     <Compile Include="GaussianProcess\CovarianceRQArd.cs" />
     <Compile Include="GaussianProcess\CovarianceMaternIso.cs" />
Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8581)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs	(revision 8582)
@@ -29,4 +29,5 @@
   public interface IGaussianProcessModel : IRegressionModel {
     double NegativeLogLikelihood { get; }
+    double SigmaNoise { get; }
     IMeanFunction MeanFunction { get; }
     ICovarianceFunction CovarianceFunction { get; }
