mlpack
Public Member Functions | List of all members
mlpack::kernel::LaplacianKernel Class Reference

The standard Laplacian kernel. More...

#include <laplacian_kernel.hpp>

Public Member Functions

 LaplacianKernel ()
 Default constructor; sets bandwidth to 1.0.
 
 LaplacianKernel (double bandwidth)
 Construct the Laplacian kernel with a custom bandwidth. More...
 
template<typename VecTypeA , typename VecTypeB >
double Evaluate (const VecTypeA &a, const VecTypeB &b) const
 Evaluation of the Laplacian kernel. More...
 
double Evaluate (const double t) const
 Evaluation of the Laplacian kernel given the distance between two points. More...
 
double Gradient (const double t) const
 Evaluation of the gradient of the Laplacian kernel given the distance between two points. More...
 
double Bandwidth () const
 Get the bandwidth.
 
double & Bandwidth ()
 Modify the bandwidth.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the kernel.
 

Detailed Description

The standard Laplacian kernel.

Given two vectors \( x \), \( y \), and a bandwidth \( \mu \) (set in the constructor),

\[ K(x, y) = \exp(-\frac{|| x - y ||}{\mu}). \]

The implementation is all in the header file because it is so simple.

Constructor & Destructor Documentation

◆ LaplacianKernel()

mlpack::kernel::LaplacianKernel::LaplacianKernel ( double  bandwidth)
inline

Construct the Laplacian kernel with a custom bandwidth.

Parameters
bandwidthThe bandwidth of the kernel ( \(\mu\)).

Member Function Documentation

◆ Evaluate() [1/2]

template<typename VecTypeA , typename VecTypeB >
double mlpack::kernel::LaplacianKernel::Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
) const
inline

Evaluation of the Laplacian kernel.

This could be generalized to use any distance metric, not the Euclidean distance, but for now, the Euclidean distance is used.

Template Parameters
VecTypeAType of first vector (likely arma::vec or arma::sp_vec).
VecTypeBType of second vector (arma::vec / arma::sp_vec).
Parameters
aFirst vector.
bSecond vector.
Returns
K(a, b) using the bandwidth ( \(\mu\)) specified in the constructor.

◆ Evaluate() [2/2]

double mlpack::kernel::LaplacianKernel::Evaluate ( const double  t) const
inline

Evaluation of the Laplacian kernel given the distance between two points.

Parameters
tThe distance between the two points the kernel should be evaluated on.
Returns
K(t) using the bandwidth ( \(\mu\)) specified in the constructor.

◆ Gradient()

double mlpack::kernel::LaplacianKernel::Gradient ( const double  t) const
inline

Evaluation of the gradient of the Laplacian kernel given the distance between two points.

Parameters
tThe distance between the two points the kernel should be evaluated on.
Returns
K(t) using the bandwidth ( \(\mu\)) specified in the constructor.

The documentation for this class was generated from the following file: