Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs	(revision 14891)
@@ -26,5 +26,4 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
-using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -39,9 +38,10 @@
   [Creatable(CreatableAttribute.Categories.DataAnalysisRegression, Priority = 160)]
   [StorableClass]
-  public sealed class GaussianProcessRegression : GaussianProcessBase, IStorableContent {
+  public sealed class GaussianProcessRegression : GaussianProcessBase, IStorableContent, IDataAnalysisAlgorithm<IRegressionProblem> {
     public string Filename { get; set; }
 
     public override Type ProblemType { get { return typeof(IRegressionProblem); } }
-    public new IRegressionProblem Problem {
+    public new IRegressionProblem Problem
+    {
       get { return (IRegressionProblem)base.Problem; }
       set { base.Problem = value; }
@@ -53,16 +53,20 @@
 
     #region parameter properties
-    public IConstrainedValueParameter<IGaussianProcessRegressionModelCreator> GaussianProcessModelCreatorParameter {
+    public IConstrainedValueParameter<IGaussianProcessRegressionModelCreator> GaussianProcessModelCreatorParameter
+    {
       get { return (IConstrainedValueParameter<IGaussianProcessRegressionModelCreator>)Parameters[ModelCreatorParameterName]; }
     }
-    public IFixedValueParameter<GaussianProcessRegressionSolutionCreator> GaussianProcessSolutionCreatorParameter {
+    public IFixedValueParameter<GaussianProcessRegressionSolutionCreator> GaussianProcessSolutionCreatorParameter
+    {
       get { return (IFixedValueParameter<GaussianProcessRegressionSolutionCreator>)Parameters[SolutionCreatorParameterName]; }
     }
-    public IFixedValueParameter<BoolValue> CreateSolutionParameter {
+    public IFixedValueParameter<BoolValue> CreateSolutionParameter
+    {
       get { return (IFixedValueParameter<BoolValue>)Parameters[CreateSolutionParameterName]; }
     }
     #endregion
     #region properties
-    public bool CreateSolution {
+    public bool CreateSolution
+    {
       get { return CreateSolutionParameter.Value.Value; }
       set { CreateSolutionParameter.Value.Value = value; }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/CicularKernel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/CicularKernel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/CicularKernel.cs	(revision 14891)
@@ -27,5 +27,5 @@
 namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression {
   [StorableClass]
-  [Item("CircularKernel", "A circular kernel function 2*pi*(acos(-d)-d*(1-n²)^(0.5)) where n = ||x-c|| and d = n/beta")]
+  [Item("CircularKernel", "A circular kernel function 2*pi*(acos(-d)-d*(1-d²)^(0.5)) where n = ||x-c|| and d = n/beta \n  As described in http://crsouza.com/2010/03/17/kernel-functions-for-machine-learning-applications/")]
   public class CircularKernel : KernelBase {
 
@@ -45,15 +45,17 @@
     protected override double Get(double norm) {
       var beta = Beta.Value;
-      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      if (norm >= beta) return 0;
+      if (Math.Abs(Beta.Value) < double.Epsilon) return double.NaN;
+      if (norm >= Beta.Value) return 0;
       var d = norm / beta;
-      return Math.Acos(-d) - d * Math.Sqrt(1 - d * d) - Math.PI / 2;
+      return 2 * Math.PI * (Math.Acos(-d) - d * Math.Sqrt(1 - d * d));
     }
 
+    // 4*pi*n^3 / (beta^4 * sqrt(1-n^2/beta^2) 
     protected override double GetGradient(double norm) {
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
       if (beta < norm) return 0;
-      return -2 * Math.Pow(norm, 3) / (Math.Pow(beta, 4) * Math.Sqrt(1 - norm * norm / (beta * beta)));
+      var d = norm / beta;
+      return -4 * Math.PI * d * d * d / beta * Math.Sqrt(1 - d * d);
     }
   }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/GaussianKernel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/GaussianKernel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/GaussianKernel.cs	(revision 14891)
@@ -29,5 +29,5 @@
 namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression {
   [StorableClass]
-  [Item("GaussianKernel", "A kernel function that uses Gaussian function exp(-||x-c||/beta²). Positive definite beta > 0")]
+  [Item("GaussianKernel", "A kernel function that uses Gaussian function exp(-n²/beta²). As described in http://crsouza.com/2010/03/17/kernel-functions-for-machine-learning-applications/")]
   public class GaussianKernel : KernelBase {
 
@@ -48,11 +48,14 @@
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      return Math.Exp(-norm * norm / (beta * beta));
+      var d = norm / beta;
+      return Math.Exp(-d * d);
     }
 
+    //2 * n²/b²* 1/b * exp(-n²/b²)
     protected override double GetGradient(double norm) {
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      return 2 * norm * norm / Math.Pow(beta, 3) * Math.Exp(-norm * norm / (beta * beta));
+      var d = norm / beta;
+      return 2 * d * d / beta * Math.Exp(-d * d);
     }
   }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs	(revision 14891)
@@ -22,11 +22,13 @@
 using System;
 using HeuristicLab.Common;
-using HeuristicLab.Core;     
+using HeuristicLab.Core;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression {
   [StorableClass]
-  [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multi-quadratic function  1 / sqrt(1+||x-c||^2/beta). Positive definite: beta > 0")]
+  [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multi-quadratic function  1 / sqrt(1+||x-c||²/beta²). Similar to http://crsouza.com/2010/03/17/kernel-functions-for-machine-learning-applications/ with beta as a scaling factor.")]
   public class InverseMultiquadraticKernel : KernelBase {
+
+    private const double C = 1.0;
     #region HLConstructors & Boilerplate
     [StorableConstructor]
@@ -35,6 +37,5 @@
     private void AfterDeserialization() { }
     protected InverseMultiquadraticKernel(InverseMultiquadraticKernel original, Cloner cloner) : base(original, cloner) { }
-    public InverseMultiquadraticKernel() {
-    }
+    public InverseMultiquadraticKernel() { }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new InverseMultiquadraticKernel(this, cloner);
@@ -45,11 +46,14 @@
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      return 1 / Math.Sqrt(1 + norm * norm / beta);
+      var d = norm / beta;
+      return 1 / Math.Sqrt(C + d * d);
     }
 
+    //n²/(b³(n²/b² + C)^1.5)
     protected override double GetGradient(double norm) {
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      return norm * norm / (2 * beta * beta * Math.Pow((norm * norm + beta) / beta, 1.5));
+      var d = norm / beta;
+      return d * d / (beta * Math.Pow(d * d + C, 1.5));
     }
   }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/MultiquadraticKernel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/MultiquadraticKernel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/MultiquadraticKernel.cs	(revision 14891)
@@ -22,5 +22,5 @@
 using System;
 using HeuristicLab.Common;
-using HeuristicLab.Core;            
+using HeuristicLab.Core;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -28,7 +28,8 @@
   [StorableClass]
   // conditionally positive definite. (need to add polynomials) see http://num.math.uni-goettingen.de/schaback/teaching/sc.pdf 
-  [Item("MultiquadraticKernel", "A kernel function that uses the multi-quadratic function (sqrt(1+||x-c||²/β).")]
+  [Item("MultiquadraticKernel", "A kernel function that uses the multi-quadratic function sqrt(1+||x-c||²/beta²). Similar to http://crsouza.com/2010/03/17/kernel-functions-for-machine-learning-applications/ with beta as a scaling factor.")]
   public class MultiquadraticKernel : KernelBase {
 
+    private const double C = 1.0;
     #region HLConstructors & Boilerplate
     [StorableConstructor]
@@ -48,12 +49,14 @@
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      return Math.Sqrt(1 + norm * norm / beta);
+      var d = norm / beta;
+      return Math.Sqrt(C + d * d);
     }
 
+    //-n²/(d³*sqrt(C+n²/d²))
     protected override double GetGradient(double norm) {
       var beta = Beta.Value;
       if (Math.Abs(beta) < double.Epsilon) return double.NaN;
-      var dividend = 2 * beta * beta * Math.Sqrt((beta + norm * norm) / beta);
-      return -norm * norm / dividend;
+      var d = norm / beta;
+      return -d * d / (beta * Math.Sqrt(C + d * d));
     }
   }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/PolysplineKernel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/PolysplineKernel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/PolysplineKernel.cs	(revision 14891)
@@ -22,5 +22,7 @@
 using System;
 using HeuristicLab.Common;
-using HeuristicLab.Core;         
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -28,6 +30,22 @@
   [StorableClass]
   // conditionally positive definite. (need to add polynomials) see http://num.math.uni-goettingen.de/schaback/teaching/sc.pdf 
-  [Item("PolysplineKernel", "A kernel function that uses the poly-spline function ||x-c||^Beta.")]
+  [Item("PolysplineKernel", "A kernel function that uses the polyharmonic function (||x-c||/Beta)^Degree as given in http://num.math.uni-goettingen.de/schaback/teaching/sc.pdf with beta as a scaling parameters.")]
   public class PolysplineKernel : KernelBase {
+
+    #region Parameternames
+    private const string DegreeParameterName = "Degree";
+    #endregion
+    #region Parameterproperties
+    public IFixedValueParameter<DoubleValue> DegreeParameter
+    {
+      get { return Parameters[DegreeParameterName] as IFixedValueParameter<DoubleValue>; }
+    }
+    #endregion
+    #region Properties
+    public DoubleValue Degree
+    {
+      get { return DegreeParameter.Value; }
+    }
+    #endregion
 
     #region HLConstructors & Boilerplate
@@ -36,7 +54,7 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() { }
-    protected PolysplineKernel(PolysplineKernel original, Cloner cloner)
-                : base(original, cloner) { }
+    protected PolysplineKernel(PolysplineKernel original, Cloner cloner) : base(original, cloner) { }
     public PolysplineKernel() {
+      Parameters.Add(new FixedValueParameter<DoubleValue>(DegreeParameterName, "The degree of the kernel. Needs to be greater than zero.", new DoubleValue(1.0)));
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -46,9 +64,16 @@
 
     protected override double Get(double norm) {
-      return Math.Pow(norm, Beta.Value);
+      var beta = Beta.Value;
+      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
+      var d = norm / beta;
+      return Math.Pow(d, Degree.Value);
     }
 
+    //-degree/beta * (norm/beta)^degree
     protected override double GetGradient(double norm) {
-      return Math.Pow(norm, Beta.Value) * Math.Log(norm);
+      var beta = Beta.Value;
+      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
+      var d = norm / beta;
+      return -Degree.Value / beta * Math.Pow(d, Degree.Value);
     }
   }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/ThinPlatePolysplineKernel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/ThinPlatePolysplineKernel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/ThinPlatePolysplineKernel.cs	(revision 14891)
@@ -23,4 +23,6 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -28,6 +30,23 @@
   [StorableClass]
   // conditionally positive definite. (need to add polynomials) see http://num.math.uni-goettingen.de/schaback/teaching/sc.pdf 
-  [Item("ThinPlatePolysplineKernel", "A kernel function that uses the ThinPlatePolyspline function ||x-c||^(2*Beta)*log(||x-c||^Beta)")]
+  [Item("ThinPlatePolysplineKernel", "A kernel function that uses the ThinPlatePolyspline function (||x-c||/Beta)^(Degree)*log(||x-c||/Beta) as described in \"Thin-Plate Spline Radial Basis Function Scheme for Advection-Diffusion Problems\" with beta as a scaling parameter.")]
   public class ThinPlatePolysplineKernel : KernelBase {
+
+    #region Parameternames
+    private const string DegreeParameterName = "Degree";
+    #endregion
+    #region Parameterproperties
+    public IFixedValueParameter<DoubleValue> DegreeParameter
+    {
+      get { return Parameters[DegreeParameterName] as IFixedValueParameter<DoubleValue>; }
+    }
+    #endregion
+    #region Properties
+    public DoubleValue Degree
+    {
+      get { return DegreeParameter.Value; }
+    }
+    #endregion
+
     #region HLConstructors & Boilerplate
     [StorableConstructor]
@@ -37,4 +56,5 @@
     protected ThinPlatePolysplineKernel(ThinPlatePolysplineKernel original, Cloner cloner) : base(original, cloner) { }
     public ThinPlatePolysplineKernel() {
+      Parameters.Add(new FixedValueParameter<DoubleValue>(DegreeParameterName, "The degree of the kernel. Needs to be greater than zero.", new DoubleValue(2.0)));
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -45,12 +65,17 @@
     protected override double Get(double norm) {
       var beta = Beta.Value;
-      if (Math.Pow(norm, beta) < 0) return double.NaN;
-      return Math.Pow(norm, 2 * beta) * Math.Log(1 + Math.Pow(norm, beta));
+      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
+      var d = norm / beta;
+      if (Math.Abs(d) < double.Epsilon) return 0;
+      return Math.Pow(d, Degree.Value) * Math.Log(d);
     }
 
+    // (Degree/beta) * (norm/beta)^Degree * log(norm/beta) 
     protected override double GetGradient(double norm) {
       var beta = Beta.Value;
-      if (Math.Pow(norm, beta) <= 0) return double.NaN;
-      return 2 * Math.Log(norm) * Math.Pow(norm, 2 * beta) * Math.Log(1 + Math.Pow(norm, beta)) + Math.Pow(norm, 3 * beta) * Math.Log(norm) / (Math.Pow(norm, beta) + 1);
+      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
+      var d = norm / beta;
+      if (Math.Abs(d) < double.Epsilon) return 0;
+      return Degree.Value / beta * Math.Pow(d, Degree.Value) * Math.Log(d);
     }
   }
Index: branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelRidgeRegressionModel.cs
===================================================================
--- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelRidgeRegressionModel.cs	(revision 14888)
+++ branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelRidgeRegressionModel.cs	(revision 14891)
@@ -32,5 +32,6 @@
   [Item("KernelRidgeRegressionModel", "A kernel ridge regression model")]
   public sealed class KernelRidgeRegressionModel : RegressionModel {
-    public override IEnumerable<string> VariablesUsedForPrediction {
+    public override IEnumerable<string> VariablesUsedForPrediction
+    {
       get { return allowedInputVariables; }
     }
@@ -38,5 +39,6 @@
     [Storable]
     private readonly string[] allowedInputVariables;
-    public string[] AllowedInputVariables {
+    public string[] AllowedInputVariables
+    {
       get { return allowedInputVariables; }
     }
@@ -114,28 +116,38 @@
         var l = new double[n, n]; Array.Copy(gram, l, l.Length);
 
+        double[,] invG;
         // cholesky decomposition
         var res = alglib.trfac.spdmatrixcholesky(ref l, n, false);
-        if (res == false) throw new ArgumentException("Could not decompose matrix. Is it quadratic symmetric positive definite?");
-
-        alglib.spdmatrixcholeskysolve(l, n, false, y, out info, out denseSolveRep, out alpha);
-        if (info != 1) throw new ArgumentException("Could not create model.");
-
-
-        {
+        if (res == false) { //throw new ArgumentException("Could not decompose matrix. Is it quadratic symmetric positive definite?");
+          int[] pivots;
+          var lua = new double[n, n];
+          Array.Copy(gram, lua, lua.Length);
+          alglib.rmatrixlu(ref lua, n, n, out pivots);
+          alglib.rmatrixlusolve(lua, pivots, n, y, out info, out denseSolveRep, out alpha);
+          if (info != 1) throw new ArgumentException("Could not create model.");
+          alglib.matinvreport rep;
+          invG = lua;  // rename
+          alglib.rmatrixluinverse(ref invG, pivots, n, out info, out rep);
+          if (info != 1) throw new ArgumentException("Could not invert Gram matrix.");
+        } else {
+          alglib.spdmatrixcholeskysolve(l, n, false, y, out info, out denseSolveRep, out alpha);
+          if (info != 1) throw new ArgumentException("Could not create model.");
           // for LOO-CV we need to build the inverse of the gram matrix
           alglib.matinvreport rep;
-          var invG = l;   // rename 
-          alglib.spdmatrixcholeskyinverse(ref invG, n, false, out info, out rep);          
+          invG = l;   // rename 
+          alglib.spdmatrixcholeskyinverse(ref invG, n, false, out info, out rep);
           if (info != 1) throw new ArgumentException("Could not invert Gram matrix.");
-          var ssqLooError = 0.0;
-          for (int i = 0; i < n; i++) {
-            var pred_i = Util.ScalarProd(Util.GetRow(gram, i).ToArray(), alpha);
-            var looPred_i = pred_i - alpha[i] / invG[i, i];
-            var error = (y[i] - looPred_i) / yScale;
-            ssqLooError += error * error;
-          }
-          LooCvRMSE = Math.Sqrt(ssqLooError / n);
-        }
-      } catch (alglib.alglibexception ae) {
+        }
+
+        var ssqLooError = 0.0;
+        for (int i = 0; i < n; i++) {
+          var pred_i = Util.ScalarProd(Util.GetRow(gram, i).ToArray(), alpha);
+          var looPred_i = pred_i - alpha[i] / invG[i, i];
+          var error = (y[i] - looPred_i) / yScale;
+          ssqLooError += error * error;
+        }
+        LooCvRMSE = Math.Sqrt(ssqLooError / n);
+      }
+      catch (alglib.alglibexception ae) {
         // wrap exception so that calling code doesn't have to know about alglib implementation
         throw new ArgumentException("There was a problem in the calculation of the kernel ridge regression model", ae);
