Class RBFKernel

Inheritance Relationships

Base Type

Class Documentation

class genif::RBFKernel : public genif::Kernel

Public Functions

RBFKernel() = default

The default constructor for this kernel. The sigma value is 1.0.

RBFKernel(data_t sigma)

Instantiates a RBF Kernel object with given sigma.

Parameters

RBFKernel(data_t sigma, data_t l)

Instantiates a RBF Kernel object with given sigma.

Parameters
  • sigma: Kernel sigma value.

  • l: A scaling value.

data_t operator()(const VectorX &x1, const VectorX &x2) const override

Returns the RBF kernel value for two vectors x1 and x2 by using the following formula.

\(k(x_1, x_2) = _l^2 \exp(- \frac{\|x_1 - x_2 \|_2^2}{2\sigma^2})\)

The norm in the equation may be substituted by a different function by constructing this object with another distance function. However, the implementation defaults to the squared L2-norm, which effectively resembles the squared euclidean distance between the input vectors.

Return

RBF kernel value for x1 and x2.

Parameters
  • x1: A vector.

  • x2: A vector.

data_t getSigma() const

Returns the sigma value, that is currently stored in this kernel.

Return

As stated above.

data_t getL() const

Returns the L scaler value, that is currently stored in this kernel.

Return

As stated above.