Changeset 14887 for branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs
- Timestamp:
- 04/24/17 18:31:44 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs
r14883 r14887 22 22 using System; 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 24 using HeuristicLab.Core; 27 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 26 29 namespace HeuristicLab.Algorithms.DataAnalysis {27 namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression { 30 28 [StorableClass] 31 [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multi quadratic function")]29 [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multi-quadratic function 1 / sqrt(1+||x-c||^2/beta). Positive definite: beta > 0")] 32 30 public class InverseMultiquadraticKernel : KernelBase { 33 31 #region HLConstructors & Boilerplate … … 38 36 protected InverseMultiquadraticKernel(InverseMultiquadraticKernel original, Cloner cloner) : base(original, cloner) { } 39 37 public InverseMultiquadraticKernel() { 40 Parameters.Add(new FixedValueParameter<DoubleValue>(BetaParameterName, "The beta in the kernel function 1 / sqrt(1+||x-c||^2/beta)", new DoubleValue(2)));41 38 } 42 39 public override IDeepCloneable Clone(Cloner cloner) { … … 46 43 47 44 protected override double Get(double norm) { 48 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 49 return 1 / Math.Sqrt(1 + norm * norm / Beta); 45 var beta = Beta.Value; 46 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 47 return 1 / Math.Sqrt(1 + norm * norm / beta); 50 48 } 51 49 52 50 protected override double GetGradient(double norm) { 53 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 54 return norm * norm / (2 * Beta * Beta * Math.Pow((norm * norm + Beta) / Beta, 1.5)); 51 var beta = Beta.Value; 52 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 53 return norm * norm / (2 * beta * beta * Math.Pow((norm * norm + beta) / beta, 1.5)); 55 54 } 56 55 }
Note: See TracChangeset
for help on using the changeset viewer.