Base-class for metrics. More...
#include <shark/Models/Kernels/AbstractMetric.h>
Public Types | |
typedef InputTypeT | InputType |
Input type of the Kernel. | |
typedef Batch< InputTypeT >::type | BatchInputType |
batch input type of the kernel | |
typedef ConstProxyReference< InputTypeconst >::type | ConstInputReference |
Const references to InputType. | |
typedef ConstProxyReference< BatchInputTypeconst >::type | ConstBatchInputReference |
Const references to BatchInputType. | |
Public Types inherited from shark::IParameterizable< VectorType > | |
typedef VectorType | ParameterVectorType |
Public Member Functions | |
AbstractMetric () | |
virtual | ~AbstractMetric () |
virtual void | read (InArchive &archive) |
From ISerializable, reads a metric from an archive. | |
virtual void | write (OutArchive &archive) const |
From ISerializable, writes a metric to an archive. | |
virtual double | featureDistanceSqr (ConstInputReference x1, ConstInputReference x2) const =0 |
Computes the squared distance in the kernel induced feature space. | |
virtual RealMatrix | featureDistanceSqr (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2) const =0 |
double | featureDistance (ConstInputReference x1, ConstInputReference x2) const |
Computes the distance in the kernel induced feature space. | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
virtual std::string | name () const |
returns the name of the object | |
Public Member Functions inherited from shark::IParameterizable< VectorType > | |
virtual | ~IParameterizable () |
virtual ParameterVectorType | parameterVector () const |
Return the parameter vector. | |
virtual void | setParameterVector (ParameterVectorType const &newParameters) |
Set the parameter vector. | |
virtual std::size_t | numberOfParameters () const |
Return the number of parameters. | |
Public Member Functions inherited from shark::ISerializable | |
virtual | ~ISerializable () |
Virtual d'tor. | |
void | load (InArchive &archive, unsigned int version) |
Versioned loading of components, calls read(...). | |
void | save (OutArchive &archive, unsigned int version) const |
Versioned storing of components, calls write(...). | |
BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Base-class for metrics.
A metric is a distance measure between objects. All kernels in shark define metrics.
Definition at line 50 of file AbstractMetric.h.
typedef Batch<InputTypeT>::type shark::AbstractMetric< InputTypeT >::BatchInputType |
batch input type of the kernel
Definition at line 55 of file AbstractMetric.h.
typedef ConstProxyReference<BatchInputTypeconst>::type shark::AbstractMetric< InputTypeT >::ConstBatchInputReference |
Const references to BatchInputType.
Definition at line 59 of file AbstractMetric.h.
typedef ConstProxyReference<InputTypeconst>::type shark::AbstractMetric< InputTypeT >::ConstInputReference |
Const references to InputType.
Definition at line 57 of file AbstractMetric.h.
typedef InputTypeT shark::AbstractMetric< InputTypeT >::InputType |
Input type of the Kernel.
Definition at line 53 of file AbstractMetric.h.
|
inline |
Definition at line 61 of file AbstractMetric.h.
|
inlinevirtual |
Definition at line 62 of file AbstractMetric.h.
|
inline |
Computes the distance in the kernel induced feature space.
Definition at line 89 of file AbstractMetric.h.
References shark::AbstractMetric< InputTypeT >::featureDistanceSqr().
|
pure virtual |
Implemented in shark::AbstractKernelFunction< InputTypeT >, and shark::AbstractKernelFunction< InputTypeT >.
|
pure virtual |
Computes the squared distance in the kernel induced feature space.
Implemented in shark::AbstractKernelFunction< InputTypeT >, and shark::AbstractKernelFunction< InputTypeT >.
Referenced by shark::AbstractMetric< InputTypeT >::featureDistance(), and shark::SimpleNearestNeighbors< InputType, LabelType >::getNeighbors().
|
inlinevirtual |
From ISerializable, reads a metric from an archive.
Reimplemented from shark::ISerializable.
Reimplemented in shark::ARDKernelUnconstrained< InputType >, shark::DiscreteKernel, shark::GaussianRbfKernel< InputType >, shark::LinearKernel< InputType >, shark::MonomialKernel< InputType >, shark::GaussianTaskKernel< InputTypeT >, shark::PolynomialKernel< InputType >, shark::ProductKernel< InputType >, shark::ProductKernel< MultiTaskSample< InputTypeT > >, shark::ScaledKernel< InputType >, shark::WeightedSumKernel< InputType >, and shark::WeightedSumKernel< InputType >.
Definition at line 65 of file AbstractMetric.h.
References shark::IParameterizable< VectorType >::setParameterVector().
|
inlinevirtual |
From ISerializable, writes a metric to an archive.
The default implementation just saves the parameters.
Reimplemented from shark::ISerializable.
Reimplemented in shark::ARDKernelUnconstrained< InputType >, shark::DiscreteKernel, shark::GaussianRbfKernel< InputType >, shark::LinearKernel< InputType >, shark::ModelKernel< InputType >, shark::MonomialKernel< InputType >, shark::GaussianTaskKernel< InputTypeT >, shark::PolynomialKernel< InputType >, shark::ProductKernel< InputType >, shark::ProductKernel< MultiTaskSample< InputTypeT > >, shark::ScaledKernel< InputType >, shark::WeightedSumKernel< InputType >, and shark::WeightedSumKernel< InputType >.
Definition at line 74 of file AbstractMetric.h.
References shark::IParameterizable< VectorType >::parameterVector().