mlpack  2.2.5
EpanechnikovKernel Class Reference

The Epanechnikov kernel, defined as. More...

Public Member Functions

 EpanechnikovKernel (const double bandwidth=1.0)
 Instantiate the Epanechnikov kernel with the given bandwidth (default 1.0). More...

 
template
<
typename
VecTypeA
,
typename
VecTypeB
>
double ConvolutionIntegral (const VecTypeA &a, const VecTypeB &b)
 Obtains the convolution integral [integral of K(||x-a||) K(||b-x||) dx] for the two vectors. More...

 
template
<
typename
VecTypeA
,
typename
VecTypeB
>
double Evaluate (const VecTypeA &a, const VecTypeB &b) const
 Evaluate the Epanechnikov kernel on the given two inputs. More...

 
double Evaluate (const double distance) const
 Evaluate the Epanechnikov kernel given that the distance between the two input points is known. More...

 
double Gradient (const double distance) const
 Evaluate the Gradient of Epanechnikov kernel given that the distance between the two input points is known. More...

 
double GradientForSquaredDistance (const double distanceSquared) const
 Evaluate the Gradient of Epanechnikov kernel given that the squared distance between the two input points is known. More...

 
double Normalizer (const size_t dimension)
 Compute the normalizer of this Epanechnikov kernel for the given dimension. More...

 
template
<
typename
Archive
>
void Serialize (Archive &ar, const unsigned int version)
 Serialize the kernel. More...

 

Detailed Description

The Epanechnikov kernel, defined as.

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

where $ b $ is the bandwidth the of the kernel (defaults to 1.0).

Definition at line 30 of file epanechnikov_kernel.hpp.

Constructor & Destructor Documentation

◆ EpanechnikovKernel()

EpanechnikovKernel ( const double  bandwidth = 1.0)
inline

Instantiate the Epanechnikov kernel with the given bandwidth (default 1.0).

Parameters
bandwidthBandwidth of the kernel.

Definition at line 38 of file epanechnikov_kernel.hpp.

References EpanechnikovKernel::ConvolutionIntegral(), EpanechnikovKernel::Evaluate(), EpanechnikovKernel::Gradient(), EpanechnikovKernel::GradientForSquaredDistance(), EpanechnikovKernel::Normalizer(), and EpanechnikovKernel::Serialize().

Member Function Documentation

◆ ConvolutionIntegral()

double ConvolutionIntegral ( const VecTypeA &  a,
const VecTypeB &  b 
)

Obtains the convolution integral [integral of K(||x-a||) K(||b-x||) dx] for the two vectors.

Template Parameters
VecTypeType of vector (arma::vec, arma::spvec should be expected).
Parameters
aFirst vector.
bSecond vector.
Returns
the convolution integral value.

Referenced by EpanechnikovKernel::EpanechnikovKernel().

◆ Evaluate() [1/2]

double Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
) const

Evaluate the Epanechnikov kernel on the given two inputs.

Template Parameters
VecTypeAType of first vector.
VecTypeBType of second vector.
Parameters
aOne input vector.
bThe other input vector.

Referenced by EpanechnikovKernel::EpanechnikovKernel().

◆ Evaluate() [2/2]

double Evaluate ( const double  distance) const

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

◆ Gradient()

double Gradient ( const double  distance) const

Evaluate the Gradient of Epanechnikov kernel given that the distance between the two input points is known.

Referenced by EpanechnikovKernel::EpanechnikovKernel().

◆ GradientForSquaredDistance()

double GradientForSquaredDistance ( const double  distanceSquared) const

Evaluate the Gradient of Epanechnikov kernel given that the squared distance between the two input points is known.

Referenced by EpanechnikovKernel::EpanechnikovKernel().

◆ Normalizer()

double Normalizer ( const size_t  dimension)

Compute the normalizer of this Epanechnikov kernel for the given dimension.

Parameters
dimensionDimension to calculate the normalizer for.

Referenced by EpanechnikovKernel::EpanechnikovKernel().

◆ Serialize()

void Serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize the kernel.

Referenced by EpanechnikovKernel::EpanechnikovKernel().


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