mlpack
|
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. | |
IPMetric & | operator= (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) |
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) }. \]
KernelType | Type of Kernel to use. This must be a Mercer kernel (positive definite), otherwise the metric may not be valid. |
VecTypeA::elem_type mlpack::metric::IPMetric< KernelType >::Evaluate | ( | const VecTypeA & | a, |
const VecTypeB & | b | ||
) |
Evaluate the metric.
VecTypeA | Type of first vector. |
VecTypeB | Type of second vector. |
a | First vector. |
b | Second vector. |