mlpack  master
Public Member Functions | Private Attributes | List of all members
mlpack::kernel::TriangularKernel Class Reference

The trivially simple triangular kernel, defined by. More...

Public Member Functions

 TriangularKernel (const double bandwidth=1.0)
 Initialize the triangular kernel with the given bandwidth (default 1.0). More...
 
double Bandwidth () const
 Get the bandwidth of the kernel. More...
 
double & Bandwidth ()
 Modify the bandwidth of the kernel. More...
 
template<typename VecTypeA , typename VecTypeB >
double Evaluate (const VecTypeA &a, const VecTypeB &b) const
 Evaluate the triangular kernel for the two given vectors. More...
 
double Evaluate (const double distance) const
 Evaluate the triangular kernel given that the distance between the two points is known. More...
 
double Gradient (const double distance) const
 Evaluate the gradient of triangular kernel given that the distance between the two points is known. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the kernel. More...
 

Private Attributes

double bandwidth
 The bandwidth of the kernel. More...
 

Detailed Description

The trivially simple triangular kernel, defined by.

\[ K(x, y) = \max \{ 0, 1 - \frac{|| x - y ||_2}{b} \} \]

where $ b $ is the bandwidth of the kernel.

Definition at line 30 of file triangular_kernel.hpp.

Constructor & Destructor Documentation

mlpack::kernel::TriangularKernel::TriangularKernel ( const double  bandwidth = 1.0)
inline

Initialize the triangular kernel with the given bandwidth (default 1.0).

Parameters
bandwidthBandwidth of the triangular kernel.

Definition at line 38 of file triangular_kernel.hpp.

Member Function Documentation

double mlpack::kernel::TriangularKernel::Bandwidth ( ) const
inline

Get the bandwidth of the kernel.

Definition at line 84 of file triangular_kernel.hpp.

References bandwidth.

double& mlpack::kernel::TriangularKernel::Bandwidth ( )
inline

Modify the bandwidth of the kernel.

Definition at line 86 of file triangular_kernel.hpp.

References bandwidth.

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

Evaluate the triangular kernel for the two given vectors.

Template Parameters
VecTypeAType of first vector.
VecTypeBType of second vector.
Parameters
aFirst vector.
bSecond vector.

Definition at line 49 of file triangular_kernel.hpp.

References bandwidth, and mlpack::metric::LMetric< TPower, TTakeRoot >::Evaluate().

double mlpack::kernel::TriangularKernel::Evaluate ( const double  distance) const
inline

Evaluate the triangular kernel given that the distance between the two points is known.

Parameters
distanceThe distance between the two points.

Definition at line 61 of file triangular_kernel.hpp.

References bandwidth.

double mlpack::kernel::TriangularKernel::Gradient ( const double  distance) const
inline

Evaluate the gradient of triangular kernel given that the distance between the two points is known.

Parameters
distanceThe distance between the two points.

Definition at line 73 of file triangular_kernel.hpp.

References bandwidth.

template<typename Archive >
void mlpack::kernel::TriangularKernel::Serialize ( Archive &  ar,
const unsigned  int 
)
inline

Serialize the kernel.

Definition at line 90 of file triangular_kernel.hpp.

References bandwidth, and mlpack::data::CreateNVP().

Member Data Documentation

double mlpack::kernel::TriangularKernel::bandwidth
private

The bandwidth of the kernel.

Definition at line 97 of file triangular_kernel.hpp.

Referenced by Bandwidth(), Evaluate(), Gradient(), and Serialize().


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