Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15158


Ignore:
Timestamp:
07/06/17 13:35:49 (7 years ago)
Author:
bwerth
Message:

#2699 added checks for Beta == null and according exceptions

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/CicularKernel.cs

    r15156 r15158  
    4141
    4242    protected override double Get(double norm) {
     43      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    4344      var beta = Beta.Value;
    4445      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     
    5051    // 4*pi*n^3 / (beta^4 * sqrt(1-n^2/beta^2)
    5152    protected override double GetGradient(double norm) {
     53      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance gradient while Beta is null");
    5254      var beta = Beta.Value;
    5355      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/GaussianKernel.cs

    r15156 r15158  
    4444
    4545    protected override double Get(double norm) {
     46      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    4647      var beta = Beta.Value;
    4748      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     
    5253    //2 * n²/b²* 1/b * exp(-n²/b²)
    5354    protected override double GetGradient(double norm) {
     55      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance gradient while Beta is null");
    5456      var beta = Beta.Value;
    5557      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/InverseMultiquadraticKernel.cs

    r15156 r15158  
    4343
    4444    protected override double Get(double norm) {
     45      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    4546      var beta = Beta.Value;
    4647      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     
    5152    //n²/(b³(n²/b² + C)^1.5)
    5253    protected override double GetGradient(double norm) {
     54      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance gradient while Beta is null");
    5355      var beta = Beta.Value;
    5456      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/MultiquadraticKernel.cs

    r15156 r15158  
    3636    protected MultiquadraticKernel(bool deserializing) : base(deserializing) { }
    3737
    38     protected MultiquadraticKernel(MultiquadraticKernel original, Cloner cloner)
    39                 : base(original, cloner) { }
     38    protected MultiquadraticKernel(MultiquadraticKernel original, Cloner cloner) : base(original, cloner) { }
    4039
    4140    public MultiquadraticKernel() { }
     
    4645
    4746    protected override double Get(double norm) {
     47      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    4848      var beta = Beta.Value;
    4949      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     
    5454    //-n²/(d³*sqrt(C+n²/d²))
    5555    protected override double GetGradient(double norm) {
     56      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance gradient while Beta is null");
    5657      var beta = Beta.Value;
    5758      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/PolysplineKernel.cs

    r15157 r15158  
    5757
    5858    protected override double Get(double norm) {
     59      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    5960      var beta = Beta.Value;
    6061      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     
    6566    //-degree/beta * (norm/beta)^degree
    6667    protected override double GetGradient(double norm) {
     68      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance gradient while Beta is null");
    6769      var beta = Beta.Value;
    6870      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/KernelRidgeRegression/KernelFunctions/ThinPlatePolysplineKernel.cs

    r15157 r15158  
    5656
    5757    protected override double Get(double norm) {
     58      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    5859      var beta = Beta.Value;
    5960      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
     
    6566    // (Degree/beta) * (norm/beta)^Degree * log(norm/beta)
    6667    protected override double GetGradient(double norm) {
     68      if (Beta == null) throw new InvalidOperationException("Can not calculate kernel distance while Beta is null");
    6769      var beta = Beta.Value;
    6870      if (Math.Abs(beta) < double.Epsilon) return double.NaN;
Note: See TracChangeset for help on using the changeset viewer.