Monomial kernel. Calculates \( \left\langle x_1, x_2 \right\rangle^m_exponent \). More...
#include <shark/Models/Kernels/MonomialKernel.h>
Public Member Functions | |
MonomialKernel () | |
MonomialKernel (unsigned int n) | |
std::string | name () const |
From INameable: return the class name. | |
RealVector | parameterVector () const |
Return the parameter vector. | |
void | setParameterVector (RealVector const &newParameters) |
Set the parameter vector. | |
std::size_t | numberOfParameters () const |
Return the number of parameters. | |
boost::shared_ptr< State > | createState () const |
creates the internal state of the kernel | |
double | eval (ConstInputReference x1, ConstInputReference x2) const |
void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result) const |
void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result, State &state) const |
void | weightedParameterDerivative (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix const &coefficients, State const &state, RealVector &gradient) const |
void | weightedInputDerivative (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix const &coefficientsX2, State const &state, BatchInputType &gradient) const |
void | read (InArchive &ar) |
From ISerializable, reads a metric from an archive. | |
void | write (OutArchive &ar) const |
From ISerializable, writes a metric to an archive. | |
Public Member Functions inherited from shark::AbstractKernelFunction< InputTypeT > | |
AbstractKernelFunction () | |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasFirstParameterDerivative () const |
bool | hasFirstInputDerivative () const |
bool | isNormalized () const |
bool | supportsVariableInputSize () const |
virtual double | eval (ConstInputReference x1, ConstInputReference x2) const |
Evaluates the kernel function. | |
double | operator() (ConstInputReference x1, ConstInputReference x2) const |
Convenience operator which evaluates the kernel function. | |
virtual void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result, State &state) const =0 |
Evaluates the subset of the KernelGram matrix which is defined by X1(rows) and X2 (columns). | |
virtual void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result) const |
Evaluates the subset of the KernelGram matrix which is defined by X1(rows) and X2 (columns). | |
RealMatrix | operator() (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2) const |
Evaluates the subset of the KernelGram matrix which is defined by X1(rows) and X2 (columns). | |
virtual void | weightedParameterDerivative (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix const &coefficients, State const &state, RealVector &gradient) const |
Computes the gradient of the parameters as a weighted sum over the gradient of all elements of the batch. | |
virtual void | weightedInputDerivative (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix const &coefficientsX2, State const &state, BatchInputType &gradient) const |
Calculates the derivative of the inputs X1 (only x1!). | |
virtual double | featureDistanceSqr (ConstInputReference x1, ConstInputReference x2) const |
Computes the squared distance in the kernel induced feature space. | |
virtual RealMatrix | featureDistanceSqr (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2) const |
Computes the squared distance in the kernel induced feature space. | |
Public Member Functions inherited from shark::AbstractMetric< InputTypeT > | |
AbstractMetric () | |
virtual | ~AbstractMetric () |
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 () |
Public Member Functions inherited from shark::IParameterizable< VectorType > | |
virtual | ~IParameterizable () |
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 () | |
Protected Attributes | |
int | m_exponent |
the exponent of the monomials | |
Protected Attributes inherited from shark::AbstractKernelFunction< InputTypeT > | |
Features | m_features |
Monomial kernel. Calculates \( \left\langle x_1, x_2 \right\rangle^m_exponent \).
Definition at line 50 of file MonomialKernel.h.
typedef base_type::BatchInputType shark::MonomialKernel< InputType >::BatchInputType |
Definition at line 66 of file MonomialKernel.h.
typedef base_type::ConstBatchInputReference shark::MonomialKernel< InputType >::ConstBatchInputReference |
Definition at line 68 of file MonomialKernel.h.
typedef base_type::ConstInputReference shark::MonomialKernel< InputType >::ConstInputReference |
Definition at line 67 of file MonomialKernel.h.
|
inline |
Definition at line 69 of file MonomialKernel.h.
References shark::AbstractKernelFunction< InputType >::HAS_FIRST_INPUT_DERIVATIVE, shark::AbstractKernelFunction< InputType >::HAS_FIRST_PARAMETER_DERIVATIVE, shark::AbstractKernelFunction< InputTypeT >::m_features, and shark::AbstractKernelFunction< InputType >::SUPPORTS_VARIABLE_INPUT_SIZE.
|
inline |
Definition at line 74 of file MonomialKernel.h.
References shark::AbstractKernelFunction< InputType >::HAS_FIRST_INPUT_DERIVATIVE, shark::AbstractKernelFunction< InputType >::HAS_FIRST_PARAMETER_DERIVATIVE, shark::AbstractKernelFunction< InputTypeT >::m_features, and shark::AbstractKernelFunction< InputType >::SUPPORTS_VARIABLE_INPUT_SIZE.
|
inlinevirtual |
creates the internal state of the kernel
Reimplemented from shark::AbstractKernelFunction< InputTypeT >.
Definition at line 95 of file MonomialKernel.h.
|
inline |
Definition at line 106 of file MonomialKernel.h.
References shark::MonomialKernel< InputType >::m_exponent, and SIZE_CHECK.
|
inline |
Definition at line 116 of file MonomialKernel.h.
References shark::MonomialKernel< InputType >::m_exponent, SIZE_CHECK, and shark::State::toState().
|
inline |
Definition at line 100 of file MonomialKernel.h.
References shark::MonomialKernel< InputType >::m_exponent, and SIZE_CHECK.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 81 of file MonomialKernel.h.
|
inlinevirtual |
Return the number of parameters.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 90 of file MonomialKernel.h.
|
inlinevirtual |
Return the parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 84 of file MonomialKernel.h.
|
inlinevirtual |
From ISerializable, reads a metric from an archive.
Reimplemented from shark::AbstractMetric< InputTypeT >.
Definition at line 180 of file MonomialKernel.h.
References shark::MonomialKernel< InputType >::m_exponent.
|
inlinevirtual |
Set the parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Definition at line 87 of file MonomialKernel.h.
References SIZE_CHECK.
|
inline |
Definition at line 151 of file MonomialKernel.h.
References shark::MonomialKernel< InputType >::m_exponent, SIZE_CHECK, and shark::State::toState().
|
inline |
Definition at line 140 of file MonomialKernel.h.
References SIZE_CHECK.
|
inlinevirtual |
From ISerializable, writes a metric to an archive.
The default implementation just saves the parameters.
Reimplemented from shark::AbstractMetric< InputTypeT >.
Definition at line 184 of file MonomialKernel.h.
References shark::MonomialKernel< InputType >::m_exponent.
|
protected |
the exponent of the monomials
Definition at line 190 of file MonomialKernel.h.
Referenced by shark::MonomialKernel< InputType >::eval(), shark::MonomialKernel< InputType >::eval(), shark::MonomialKernel< InputType >::eval(), shark::MonomialKernel< InputType >::read(), shark::MonomialKernel< InputType >::weightedInputDerivative(), and shark::MonomialKernel< InputType >::write().