Changeset 14891 for branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/MultiquadraticKernel.cs
- Timestamp:
- 04/26/17 11:06:51 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/MultiquadraticKernel.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 … … 28 28 [StorableClass] 29 29 // conditionally positive definite. (need to add polynomials) see http://num.math.uni-goettingen.de/schaback/teaching/sc.pdf 30 [Item("MultiquadraticKernel", "A kernel function that uses the multi-quadratic function (sqrt(1+||x-c||²/β).")]30 [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.")] 31 31 public class MultiquadraticKernel : KernelBase { 32 32 33 private const double C = 1.0; 33 34 #region HLConstructors & Boilerplate 34 35 [StorableConstructor] … … 48 49 var beta = Beta.Value; 49 50 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 50 return Math.Sqrt(1 + norm * norm / beta); 51 var d = norm / beta; 52 return Math.Sqrt(C + d * d); 51 53 } 52 54 55 //-n²/(d³*sqrt(C+n²/d²)) 53 56 protected override double GetGradient(double norm) { 54 57 var beta = Beta.Value; 55 58 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 56 var d ividend = 2 * beta * beta * Math.Sqrt((beta + norm * norm) / beta);57 return - norm * norm / dividend;59 var d = norm / beta; 60 return -d * d / (beta * Math.Sqrt(C + d * d)); 58 61 } 59 62 }
Note: See TracChangeset
for help on using the changeset viewer.