Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/17 13:17:43 (7 years ago)
Author:
bwerth
Message:

#2699 checked and reformulated gradient functions for kernels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/RadialBasisFunctions/KernelFunctions/GaussianKernel.cs

    r14872 r14883  
    4747
    4848    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));
    5151    }
    5252
    5353    protected override double GetGradient(double norm) {
    5454      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));
    5756    }
    5857  }
Note: See TracChangeset for help on using the changeset viewer.