Changeset 14891 for branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs
- Timestamp:
- 04/26/17 11:06:51 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs
r14887 r14891 22 22 using System; 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 26 27 27 namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression { 28 28 [StorableClass] 29 [Item("InverseMultiquadraticKernel", "A kernel function that uses the inverse multi-quadratic function 1 / sqrt(1+||x-c|| ^2/beta). Positive definite: beta > 0")]29 [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.")] 30 30 public class InverseMultiquadraticKernel : KernelBase { 31 32 private const double C = 1.0; 31 33 #region HLConstructors & Boilerplate 32 34 [StorableConstructor] … … 35 37 private void AfterDeserialization() { } 36 38 protected InverseMultiquadraticKernel(InverseMultiquadraticKernel original, Cloner cloner) : base(original, cloner) { } 37 public InverseMultiquadraticKernel() { 38 } 39 public InverseMultiquadraticKernel() { } 39 40 public override IDeepCloneable Clone(Cloner cloner) { 40 41 return new InverseMultiquadraticKernel(this, cloner); … … 45 46 var beta = Beta.Value; 46 47 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 47 return 1 / Math.Sqrt(1 + norm * norm / beta); 48 var d = norm / beta; 49 return 1 / Math.Sqrt(C + d * d); 48 50 } 49 51 52 //n²/(b³(n²/b² + C)^1.5) 50 53 protected override double GetGradient(double norm) { 51 54 var beta = Beta.Value; 52 55 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 53 return norm * norm / (2 * beta * beta * Math.Pow((norm * norm + beta) / beta, 1.5)); 56 var d = norm / beta; 57 return d * d / (beta * Math.Pow(d * d + C, 1.5)); 54 58 } 55 59 }
Note: See TracChangeset
for help on using the changeset viewer.