Class Gaussian

java.lang.Object
smile.math.kernel.Gaussian
All Implemented Interfaces:
Serializable, IsotropicKernel, Function
Direct Known Subclasses:
BinarySparseGaussianKernel, GaussianKernel, SparseGaussianKernel

public class Gaussian extends Object implements IsotropicKernel
Gaussian kernel, also referred as RBF kernel or squared exponential kernel.

k(u, v) = exp(-||u-v||2 / 2σ2)

where σ > 0 is the scale parameter of the kernel.

The Gaussian kernel is a good choice for a great deal of applications, although sometimes it is remarked as being overused.

See Also:
  • Constructor Details

    • Gaussian

      public Gaussian(double sigma, double lo, double hi)
      Constructor.
      Parameters:
      sigma - The length scale of kernel.
      lo - The lower bound of length scale for hyperparameter tuning.
      hi - The upper bound of length scale for hyperparameter tuning.
  • Method Details

    • scale

      public double scale()
      Returns the length scale of kernel.
      Returns:
      the length scale of kernel.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • k

      public double k(double dist)
      Description copied from interface: IsotropicKernel
      Computes the isotropic kernel function.
      Specified by:
      k in interface IsotropicKernel
      Parameters:
      dist - The distance.
      Returns:
      the kernel value.
    • kg

      public double[] kg(double dist)
      Description copied from interface: IsotropicKernel
      Computes the isotropic kernel function and its gradient over hyperparameters.
      Specified by:
      kg in interface IsotropicKernel
      Parameters:
      dist - The distance.
      Returns:
      the kernel value and gradient.