Class RBFKernel

Inheritance Relationships

Base Type

Class Documentation

class RBFKernel : public Kernel

The RBF Kernel:

\[ k(x_1, x_2) = scale \cdot \exp\left(- \frac{\|x_1 - x_2 \|_2^2}{sigma}\right) \]
where \( scale > 0\) and \(sigma > 0\).

Public Functions

RBFKernel() = default

The default constructor for this kernel. The sigma value is 1.0 and the scale is 1.0.

inline RBFKernel(data_t sigma)

Creates a new RBFKernel with the given sigma parameter and scale 1.0.

Parameters

sigma – The sigma parameter > 0.

inline RBFKernel(data_t sigma, data_t scale)

Creates a new RBFKernel with the given sigma and scale parameter.

Note

This constructor uses assert to make sure that scale/sigma has the correct range. This may lead to warnings during compilation.

Parameters
  • sigma – The sigma value > 0.

  • scale – The scale value > 0.

inline virtual data_t operator()(const std::vector<data_t> &x1, const std::vector<data_t> &x2) const override

Computes the RBF Kernel at the given points x1, x2: \(k(x_1, x_2) = scale * \exp(- \frac{\|x_1 - x_2 \|_2^2}{sigma)\) where \(scale > 0\) and \(sigma > 0\).

Parameters
  • x1 – First argument for the kernel.

  • x2 – Second argument for the kernel

inline virtual std::shared_ptr<Kernel> clone() const override

Returns a clone of this kernel.

Note

The clone is a deep copy of this kernel.