Changeset 14883 for branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions
- Timestamp:
- 04/24/17 13:17:43 (8 years ago)
- Location:
- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/CicularKernel.cs
r14872 r14883 47 47 48 48 protected override double Get(double norm) { 49 if (norm >= Beta || Math.Abs(Beta) < double.Epsilon) return 0; 49 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 50 if (norm >= Beta) return 0; 50 51 var d = norm / Beta; 51 52 return Math.Acos(-d) - d * Math.Sqrt(1 - d * d) - Math.PI / 2; … … 53 54 54 55 protected override double GetGradient(double norm) { 55 if ( Beta <= 0) return double.NaN;56 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 56 57 if (Beta < norm) return 0; 57 return 2 * norm * Math.Sqrt(Beta * Beta - norm * norm) / (Beta * Beta * Beta);58 return -2*Math.Pow(norm,3)/(Math.Pow(Beta,4)*Math.Sqrt(1-norm*norm/(Beta*Beta))); 58 59 } 59 60 } -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/GaussianKernel.cs
r14872 r14883 47 47 48 48 protected override double Get(double norm) { 49 if (Math.Abs(Beta) < double.Epsilon) return 0;50 return Math. Abs(norm) < double.Epsilon ? 1 : Math.Exp(-norm * norm / (Beta * Beta));49 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 50 return Math.Exp(-norm * norm / (Beta * Beta)); 51 51 } 52 52 53 53 protected override double GetGradient(double norm) { 54 54 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 55 norm *= norm; 56 return 2 * norm * Math.Exp(-norm / (Beta * Beta)) / (Beta * Beta * Beta); 55 return 2 * norm * norm / Math.Pow(Beta, 3) * Math.Exp(-norm * norm / (Beta * Beta)); 57 56 } 58 57 } -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/InverseMultiquadraticKernel.cs
r14872 r14883 46 46 47 47 protected override double Get(double norm) { 48 if (Math.Abs(Beta) < double.Epsilon) return 0;48 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 49 49 return 1 / Math.Sqrt(1 + norm * norm / Beta); 50 50 } … … 52 52 protected override double GetGradient(double norm) { 53 53 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 54 norm *= norm; 55 return norm / (2 * Beta * Beta * Math.Pow((norm + Beta) / Beta, 1.5)); 54 return norm * norm / (2 * Beta * Beta * Math.Pow((norm * norm + Beta) / Beta, 1.5)); 56 55 } 57 56 } -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/LaplacianKernel.cs
r14872 r14883 44 44 45 45 protected override double Get(double norm) { 46 return Math.Abs(Beta) < double.Epsilon ? 0 : Math.Exp(-norm / Beta); 46 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 47 return Math.Exp(-norm / Beta); 47 48 } 48 49 -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/MultiquadraticKernel.cs
r14872 r14883 48 48 #endregion 49 49 protected override double Get(double norm) { 50 return Math.Abs(Beta) < double.Epsilon ? 0 : Math.Sqrt(1 + norm * norm / Beta); 50 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 51 return Math.Sqrt(1 + norm * norm / Beta); 51 52 } 52 53 53 54 protected override double GetGradient(double norm) { 54 55 if (Math.Abs(Beta) < double.Epsilon) return double.NaN; 55 norm *= norm;56 return -norm / (2 * Beta * Beta * Math.Sqrt((norm + Beta) / Beta));56 var dividend = 2 * Beta * Beta * Math.Sqrt((Beta + norm * norm) / Beta); 57 return -norm * norm / dividend; 57 58 } 58 59 } -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/PolysplineKernel.cs
r14872 r14883 52 52 53 53 protected override double GetGradient(double norm) { 54 return Math.Pow(norm, Beta) * Math.Log( Beta);54 return Math.Pow(norm, Beta) * Math.Log(norm); 55 55 } 56 56 } -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/ThinPlatePolysplineKernel.cs
r14872 r14883 46 46 47 47 protected override double Get(double norm) { 48 if (Math.Pow(norm, Beta) <= 0) return 0;49 return Math.Pow(norm, Beta * 2) * Math.Log(1 + Math.Pow(norm, Beta));48 if (Math.Pow(norm, Beta) <= 0) return double.NaN; 49 return Math.Pow(norm, 2 * Beta) * Math.Log(1 + Math.Pow(norm, Beta)); 50 50 } 51 51 52 52 protected override double GetGradient(double norm) { 53 53 if (Math.Pow(norm, Beta) <= 0) return double.NaN; 54 var ax = Math.Pow(norm, Beta); 55 var a2x = ax * ax; 56 var a3x = a2x * ax; 57 var loga = Math.Log(norm); 58 return 2 * a2x * loga * Math.Log(ax + 1) + a3x * loga / (ax + 1); 54 return 2 * Math.Log(norm) * Math.Pow(norm, 2 * Beta) * Math.Log(1 + Math.Pow(norm, Beta)) + Math.Pow(norm, 3 * Beta) * Math.Log(norm) / (Math.Pow(norm, Beta) + 1); 59 55 } 60 56 }
Note: See TracChangeset
for help on using the changeset viewer.