Changeset 14891 for branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/CicularKernel.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/CicularKernel.cs
r14887 r14891 27 27 namespace HeuristicLab.Algorithms.DataAnalysis.KernelRidgeRegression { 28 28 [StorableClass] 29 [Item("CircularKernel", "A circular kernel function 2*pi*(acos(-d)-d*(1- n²)^(0.5)) where n = ||x-c|| and d = n/beta")]29 [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/")] 30 30 public class CircularKernel : KernelBase { 31 31 … … 45 45 protected override double Get(double norm) { 46 46 var beta = Beta.Value; 47 if (Math.Abs( beta) < double.Epsilon) return double.NaN;48 if (norm >= beta) return 0;47 if (Math.Abs(Beta.Value) < double.Epsilon) return double.NaN; 48 if (norm >= Beta.Value) return 0; 49 49 var d = norm / beta; 50 return Math.Acos(-d) - d * Math.Sqrt(1 - d * d) - Math.PI / 2;50 return 2 * Math.PI * (Math.Acos(-d) - d * Math.Sqrt(1 - d * d)); 51 51 } 52 52 53 // 4*pi*n^3 / (beta^4 * sqrt(1-n^2/beta^2) 53 54 protected override double GetGradient(double norm) { 54 55 var beta = Beta.Value; 55 56 if (Math.Abs(beta) < double.Epsilon) return double.NaN; 56 57 if (beta < norm) return 0; 57 return -2 * Math.Pow(norm, 3) / (Math.Pow(beta, 4) * Math.Sqrt(1 - norm * norm / (beta * beta))); 58 var d = norm / beta; 59 return -4 * Math.PI * d * d * d / beta * Math.Sqrt(1 - d * d); 58 60 } 59 61 }
Note: See TracChangeset
for help on using the changeset viewer.