mlpack
Public Member Functions | List of all members
mlpack::metric::IPMetric< KernelType > Class Template Reference

The inner product metric, IPMetric, takes a given Mercer kernel (KernelType), and when Evaluate() is called, returns the distance between the two points in kernel space: More...

#include <ip_metric.hpp>

Public Member Functions

 IPMetric ()
 Create the IPMetric without an instantiated kernel.
 
 IPMetric (KernelType &kernel)
 Create the IPMetric with an instantiated kernel.
 
 ~IPMetric ()
 Destroy the IPMetric object.
 
 IPMetric (const IPMetric &other)
 Copy the parameters of the given metric.
 
IPMetricoperator= (const IPMetric &other)
 Assign this metric to be a copy of the given metric.
 
template<typename VecTypeA , typename VecTypeB >
VecTypeA::elem_type Evaluate (const VecTypeA &a, const VecTypeB &b)
 Evaluate the metric. More...
 
const KernelType & Kernel () const
 Get the kernel.
 
KernelType & Kernel ()
 Modify the kernel.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t version)
 Serialize the metric.
 
template<typename Vec1Type , typename Vec2Type >
Vec1Type::elem_type Evaluate (const Vec1Type &a, const Vec2Type &b)
 
template<>
Vec1Type::elem_type Evaluate (const Vec1Type &a, const Vec2Type &b)
 

Detailed Description

template<typename KernelType>
class mlpack::metric::IPMetric< KernelType >

The inner product metric, IPMetric, takes a given Mercer kernel (KernelType), and when Evaluate() is called, returns the distance between the two points in kernel space:

\[ d(x, y) = \sqrt{ K(x, x) + K(y, y) - 2K(x, y) }. \]

Template Parameters
KernelTypeType of Kernel to use. This must be a Mercer kernel (positive definite), otherwise the metric may not be valid.

Member Function Documentation

◆ Evaluate()

template<typename KernelType>
template<typename VecTypeA , typename VecTypeB >
VecTypeA::elem_type mlpack::metric::IPMetric< KernelType >::Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
)

Evaluate the metric.

Template Parameters
VecTypeAType of first vector.
VecTypeBType of second vector.
Parameters
aFirst vector.
bSecond vector.
Returns
Distance between the two points in kernel space.

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