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 IPMetric< KernelType >:

Public Member Functions

 IPMetric ()
 Create the IPMetric without an instantiated kernel. More...

 
 IPMetric (KernelType &kernel)
 Create the IPMetric with an instantiated kernel. More...

 
 IPMetric (const IPMetric &other)
 Copy the parameters of the given metric. 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...

 
IPMetricoperator= (const IPMetric &other)
 Assign this metric to be a copy of the given metric. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t 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]

const KernelType& Kernel ( ) const
inline

Get the kernel.

Definition at line 63 of file ip_metric.hpp.

◆ Kernel() [2/2]

KernelType& Kernel ( )
inline

Modify the kernel.

Definition at line 65 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 uint32_t  version 
)

Serialize the metric.

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


The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-git/src/mlpack/core/metrics/ip_metric.hpp