Kernel on a finite, discrete space. More...
#include <shark/Models/Kernels/DiscreteKernel.h>
Inheritance diagram for shark::DiscreteKernel:Public Member Functions | |
| DiscreteKernel (RealMatrix const &matrix) | |
| Construction of the kernel from a positive definite, symmetric matrix. | |
| 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. | |
| std::size_t | size () const |
| Cardinality of the discrete space. | |
| boost::shared_ptr< State > | createState () const |
| DiscreteKernels don't have a state so they return an EmptyState object. | |
| double | eval (ConstInputReference x1, ConstInputReference x2) const |
| Evaluates the kernel function. | |
| void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result, State &state) const |
| Evaluates the kernel function for every point combination of the two batches. | |
| void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result) const |
| Evaluates the kernel function for every point combination of the two batches. | |
| void | read (InArchive &ar) |
| From ISerializable. | |
| void | write (OutArchive &ar) const |
| From ISerializable. | |
Public Member Functions inherited from shark::AbstractKernelFunction< std::size_t > | |
| AbstractKernelFunction () | |
| const Features & | features () const |
| virtual void | updateFeatures () |
| bool | hasFirstParameterDerivative () const |
| bool | hasFirstInputDerivative () const |
| bool | isNormalized () const |
| bool | supportsVariableInputSize () const |
| double | operator() (ConstInputReference x1, ConstInputReference x2) const |
| Convenience operator which evaluates the kernel function. | |
| 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 () |
| 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 () |
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 | |
| RealMatrix | m_matrix |
| kernel matrix | |
Protected Attributes inherited from shark::AbstractKernelFunction< std::size_t > | |
| Features | m_features |
Additional Inherited Members | |
Public Types inherited from shark::AbstractKernelFunction< std::size_t > | |
| enum | Feature |
| enumerations of kerneland metric features (flags) More... | |
| typedef base_type::InputType | InputType |
| Input type of the Kernel. | |
| typedef base_type::BatchInputType | BatchInputType |
| batch input type of the kernel | |
| typedef base_type::ConstInputReference | ConstInputReference |
| Const references to InputType. | |
| typedef base_type::ConstBatchInputReference | ConstBatchInputReference |
| Const references to BatchInputType. | |
| typedef TypedFlags< Feature > | Features |
| This statement declares the member m_features. See Core/Flags.h for details. | |
| typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Types inherited from shark::AbstractMetric< InputTypeT > | |
| 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 |
Kernel on a finite, discrete space.
Definition at line 56 of file DiscreteKernel.h.
|
inline |
Construction of the kernel from a positive definite, symmetric matrix.
Definition at line 62 of file DiscreteKernel.h.
References SHARK_RUNTIME_CHECK.
|
inlinevirtual |
DiscreteKernels don't have a state so they return an EmptyState object.
Reimplemented from shark::AbstractKernelFunction< std::size_t >.
Definition at line 101 of file DiscreteKernel.h.
|
inlinevirtual |
Evaluates the kernel function for every point combination of the two batches.
The function returns the stored similarity value.
Reimplemented from shark::AbstractKernelFunction< std::size_t >.
Definition at line 122 of file DiscreteKernel.h.
References shark::batchSize(), and m_matrix.
|
inlinevirtual |
Evaluates the kernel function for every point combination of the two batches.
The function returns the stored similarity value.
Implements shark::AbstractKernelFunction< std::size_t >.
Definition at line 116 of file DiscreteKernel.h.
References eval().
|
inlinevirtual |
Evaluates the kernel function.
The function returns the stored similarity value.
Reimplemented from shark::AbstractKernelFunction< std::size_t >.
Definition at line 108 of file DiscreteKernel.h.
References m_matrix.
Referenced by eval().
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Reimplemented in shark::GaussianTaskKernel< InputTypeT >.
Definition at line 78 of file DiscreteKernel.h.
|
inlinevirtual |
Return the number of parameters.
Reimplemented from shark::IParameterizable< VectorType >.
Reimplemented in shark::GaussianTaskKernel< InputTypeT >.
Definition at line 91 of file DiscreteKernel.h.
|
inlinevirtual |
Return the parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Reimplemented in shark::GaussianTaskKernel< InputTypeT >.
Definition at line 81 of file DiscreteKernel.h.
|
inlinevirtual |
From ISerializable.
Reimplemented from shark::AbstractMetric< InputTypeT >.
Reimplemented in shark::GaussianTaskKernel< InputTypeT >.
Definition at line 133 of file DiscreteKernel.h.
References m_matrix.
Referenced by shark::GaussianTaskKernel< InputTypeT >::read().
|
inlinevirtual |
Set the parameter vector.
Reimplemented from shark::IParameterizable< VectorType >.
Reimplemented in shark::GaussianTaskKernel< InputTypeT >.
Definition at line 86 of file DiscreteKernel.h.
References SIZE_CHECK.
|
inline |
Cardinality of the discrete space.
Definition at line 97 of file DiscreteKernel.h.
References m_matrix.
Referenced by shark::GaussianTaskKernel< InputTypeT >::numberOfTasks().
|
inlinevirtual |
From ISerializable.
Reimplemented from shark::AbstractMetric< InputTypeT >.
Reimplemented in shark::GaussianTaskKernel< InputTypeT >.
Definition at line 137 of file DiscreteKernel.h.
References m_matrix.
Referenced by shark::GaussianTaskKernel< InputTypeT >::write().
|
protected |
kernel matrix
Definition at line 142 of file DiscreteKernel.h.
Referenced by shark::GaussianTaskKernel< InputTypeT >::computeMatrix(), eval(), eval(), read(), size(), and write().