mlpack  master
Public Member Functions | Private Attributes | 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...

Inheritance diagram for mlpack::metric::IPMetric< KernelType >:
Inheritance graph
[legend]

Public Member Functions

 IPMetric ()
 Create the IPMetric without an instantiated kernel. More...
 
 IPMetric (KernelType &kernel)
 Create the IPMetric with an instantiated kernel. More...
 
 ~IPMetric ()
 Destroy the IPMetric object. More...
 
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. More...
 
KernelType & Kernel ()
 Modify the kernel. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int version)
 Serialize the metric. More...
 

Private Attributes

KernelType * kernel
 The kernel we are using. More...
 
bool kernelOwner
 If true, we are responsible for deleting the kernel. More...
 

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.

Definition at line 32 of file ip_metric.hpp.

Constructor & Destructor Documentation

template<typename KernelType>
mlpack::metric::IPMetric< KernelType >::IPMetric ( )

Create the IPMetric without an instantiated kernel.

template<typename KernelType>
mlpack::metric::IPMetric< KernelType >::IPMetric ( KernelType &  kernel)

Create the IPMetric with an instantiated kernel.

template<typename KernelType>
mlpack::metric::IPMetric< KernelType >::~IPMetric ( )

Destroy the IPMetric object.

Member Function Documentation

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.
template<typename KernelType>
const KernelType& mlpack::metric::IPMetric< KernelType >::Kernel ( ) const
inline

Get the kernel.

Definition at line 57 of file ip_metric.hpp.

template<typename KernelType>
KernelType& mlpack::metric::IPMetric< KernelType >::Kernel ( )
inline

Modify the kernel.

Definition at line 59 of file ip_metric.hpp.

template<typename KernelType>
template<typename Archive >
void mlpack::metric::IPMetric< KernelType >::Serialize ( Archive &  ar,
const unsigned int  version 
)

Member Data Documentation

template<typename KernelType>
KernelType* mlpack::metric::IPMetric< KernelType >::kernel
private

The kernel we are using.

Definition at line 67 of file ip_metric.hpp.

Referenced by mlpack::metric::IPMetric< kernel::EpanechnikovKernel >::Kernel().

template<typename KernelType>
bool mlpack::metric::IPMetric< KernelType >::kernelOwner
private

If true, we are responsible for deleting the kernel.

Definition at line 69 of file ip_metric.hpp.


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