Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/17 18:31:44 (7 years ago)
Author:
gkronber
Message:

#2699: worked on kernel ridge regression. moved beta parameter to algorithm. reintroduced IKernel interface to restrict choice of kernel in kernel ridge regression. speed-up by cholesky decomposition and optimization of the calculation of the covariance matrix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/GaussianKernel.cs

    r14883 r14887  
    2121
    2222using System;
     23
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    26 using HeuristicLab.Parameters;
     26
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828
    29 namespace HeuristicLab.Algorithms.DataAnalysis {
     29namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression {
    3030  [StorableClass]
    31   [Item("GaussianKernel", "A kernel function that uses Gaussian function")]
     31  [Item("GaussianKernel", "A kernel function that uses Gaussian function exp(-||x-c||/beta²). Positive definite beta > 0")]
    3232  public class GaussianKernel : KernelBase {
    3333
     
    3939    protected GaussianKernel(GaussianKernel original, Cloner cloner) : base(original, cloner) { }
    4040    public GaussianKernel() {
    41       Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernelfunction exp(-||x-c||/beta²)", new DoubleValue(2)));
    4241    }
    4342    public override IDeepCloneable Clone(Cloner cloner) {
     
    4746
    4847    protected override double Get(double norm) {
    49       if (Math.Abs(Beta) < double.Epsilon) return double.NaN;
    50       return Math.Exp(-norm * norm / (Beta * Beta));
     48      var beta = Beta.Value;
     49      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     50      return Math.Exp(-norm * norm / (beta * beta));
    5151    }
    5252
    5353    protected override double GetGradient(double norm) {
    54       if (Math.Abs(Beta) < double.Epsilon) return double.NaN;
    55       return 2 * norm * norm / Math.Pow(Beta, 3) * Math.Exp(-norm * norm / (Beta * Beta));
     54      var beta = Beta.Value;
     55      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     56      return 2 * norm * norm / Math.Pow(beta, 3) * Math.Exp(-norm * norm / (beta * beta));
    5657    }
    5758  }
Note: See TracChangeset for help on using the changeset viewer.