mlpack 3.4.2
Public Member Functions | List of all members
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. More...
 
 IPMetric (const IPMetric &other)
 Copy the parameters of the given metric. 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...
 
KernelType & Kernel ()
 Modify the kernel. More...
 
const KernelType & Kernel () const
 Get the kernel. More...
 
IPMetricoperator= (const IPMetric &other)
 Assign this metric to be a copy of the given metric. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize the metric. 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

◆ IPMetric() [1/3]

IPMetric ( )

Create the IPMetric without an instantiated kernel.

◆ IPMetric() [2/3]

IPMetric ( KernelType &  kernel)

Create the IPMetric with an instantiated kernel.

◆ ~IPMetric()

~IPMetric ( )

Destroy the IPMetric object.

◆ IPMetric() [3/3]

IPMetric ( const IPMetric< KernelType > &  other)

Copy the parameters of the given metric.

Member Function Documentation

◆ Evaluate()

VecTypeA::elem_type 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.

◆ Kernel() [1/2]

KernelType & Kernel ( )
inline

Modify the kernel.

Definition at line 65 of file ip_metric.hpp.

◆ Kernel() [2/2]

const KernelType & Kernel ( ) const
inline

Get the kernel.

Definition at line 63 of file ip_metric.hpp.

◆ operator=()

IPMetric & operator= ( const IPMetric< KernelType > &  other)

Assign this metric to be a copy of the given metric.

◆ serialize()

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

Serialize the metric.


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