Special "Gaussian-like" kernel function on tasks. More...
#include <shark/Models/Kernels/MultiTaskKernel.h>
Public Types | |
typedef InputTypeT | InputType |
typedef MultiTaskSample< InputType > | MultiTaskSampleType |
typedef AbstractKernelFunction< InputType > | KernelType |
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. More... | |
typedef base_type::BatchInputType | BatchInputType |
batch input type of the kernel More... | |
typedef base_type::ConstInputReference | ConstInputReference |
Const references to InputType. More... | |
typedef base_type::ConstBatchInputReference | ConstBatchInputReference |
Const references to BatchInputType. More... | |
typedef TypedFlags< Feature > | Features |
This statement declares the member m_features. See Core/Flags.h for details. More... | |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Types inherited from shark::AbstractMetric< std::size_t > | |
typedef std::size_t | InputType |
Input type of the Kernel. More... | |
typedef Batch< std::size_t >::type | BatchInputType |
batch input type of the kernel More... | |
typedef ConstProxyReference< InputType const >::type | ConstInputReference |
Const references to InputType. More... | |
typedef ConstProxyReference< BatchInputType const >::type | ConstBatchInputReference |
Const references to BatchInputType. More... | |
Public Types inherited from shark::IParameterizable<> | |
typedef RealVector | ParameterVectorType |
Public Member Functions | |
GaussianTaskKernel (Data< MultiTaskSampleType > const &data, std::size_t tasks, KernelType &inputkernel, double gamma) | |
Construction of a Gaussian kernel on tasks. More... | |
std::string | name () const |
From INameable: return the class name. More... | |
RealVector | parameterVector () const |
Return the parameter vector. More... | |
void | setParameterVector (RealVector const &newParameters) |
Set the parameter vector. More... | |
std::size_t | numberOfParameters () const |
Return the number of parameters. More... | |
std::size_t | numberOfTasks () const |
double | gamma () const |
Kernel bandwidth parameter. More... | |
double | sigma () const |
Kernel width parameter, equivalent to the bandwidth parameter. More... | |
void | setGamma (double gamma) |
void | setWidth (double sigma) |
Set the kernel width (equivalent to setting the bandwidth). More... | |
void | read (InArchive &ar) |
From ISerializable. More... | |
void | write (OutArchive &ar) const |
From ISerializable. More... | |
Public Member Functions inherited from shark::DiscreteKernel | |
DiscreteKernel (RealMatrix const &matrix) | |
Construction of the kernel from a positive definite, symmetric matrix. More... | |
std::size_t | size () const |
Cardinality of the discrete space. More... | |
boost::shared_ptr< State > | createState () const |
DiscreteKernels don't have a state so they return an EmptyState object. More... | |
double | eval (ConstInputReference x1, ConstInputReference x2) const |
Evaluates the kernel function. More... | |
void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result, State &state) const |
Evaluates the kernel function for every point combination of the two batches. More... | |
void | eval (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2, RealMatrix &result) const |
Evaluates the kernel function for every point combination of the two batches. More... | |
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. More... | |
RealMatrix | operator() (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2) const |
Evaluates the subset of the KernelGram matrix which is defined by X1(rows) and X2 (columns). More... | |
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. More... | |
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!). More... | |
virtual double | featureDistanceSqr (ConstInputReference x1, ConstInputReference x2) const |
Computes the squared distance in the kernel induced feature space. More... | |
virtual RealMatrix | featureDistanceSqr (ConstBatchInputReference batchX1, ConstBatchInputReference batchX2) const |
Computes the squared distance in the kernel induced feature space. More... | |
Public Member Functions inherited from shark::AbstractMetric< std::size_t > | |
AbstractMetric () | |
virtual | ~AbstractMetric () |
virtual double | featureDistanceSqr (ConstInputReference x1, ConstInputReference x2) const=0 |
Computes the squared distance in the kernel induced feature space. More... | |
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. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Public Member Functions inherited from shark::IParameterizable<> | |
virtual | ~IParameterizable () |
Public Member Functions inherited from shark::ISerializable | |
virtual | ~ISerializable () |
Virtual d'tor. More... | |
void | load (InArchive &archive, unsigned int version) |
Versioned loading of components, calls read(...). More... | |
void | save (OutArchive &archive, unsigned int version) const |
Versioned storing of components, calls write(...). More... | |
BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Protected Member Functions | |
void | computeMatrix () |
Compute the Gram matrix of the task kernel. More... | |
Protected Attributes | |
Data< MultiTaskSampleType > const & | m_data |
multi-task data More... | |
KernelType * | mpe_inputKernel |
kernel on inputs More... | |
double | m_gamma |
bandwidth of the Gaussian task kernel More... | |
Protected Attributes inherited from shark::DiscreteKernel | |
RealMatrix | m_matrix |
kernel matrix More... | |
Protected Attributes inherited from shark::AbstractKernelFunction< std::size_t > | |
Features | m_features |
Special "Gaussian-like" kernel function on tasks.
\[ k(t, t') = \exp \left( -\gamma \cdot \left\| \frac{1}{\ell_{t}\ell{t'}} \sum_{i | t_i = t}\sum_{j | t_j = t'} k'(x_i, x_j) \right\|^2 \right) \]
where k' is an arbitrary kernel on inputs.Definition at line 129 of file MultiTaskKernel.h.
typedef InputTypeT shark::GaussianTaskKernel< InputTypeT >::InputType |
Definition at line 134 of file MultiTaskKernel.h.
typedef AbstractKernelFunction<InputType> shark::GaussianTaskKernel< InputTypeT >::KernelType |
Definition at line 136 of file MultiTaskKernel.h.
typedef MultiTaskSample<InputType> shark::GaussianTaskKernel< InputTypeT >::MultiTaskSampleType |
Definition at line 135 of file MultiTaskKernel.h.
|
inline |
Construction of a Gaussian kernel on tasks.
data | unlabeled data from multiple tasks |
tasks | number of tasks in the problem |
inputkernel | kernel on inputs based on which task similarity is defined |
gamma | Gaussian bandwidth parameter (also refer to the member functions setGamma and setSigma). |
Definition at line 144 of file MultiTaskKernel.h.
|
inlineprotected |
Compute the Gram matrix of the task kernel.
Definition at line 236 of file MultiTaskKernel.h.
|
inline |
Kernel bandwidth parameter.
Definition at line 179 of file MultiTaskKernel.h.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::DiscreteKernel.
Definition at line 157 of file MultiTaskKernel.h.
|
inlinevirtual |
Return the number of parameters.
Reimplemented from shark::DiscreteKernel.
Definition at line 171 of file MultiTaskKernel.h.
|
inline |
Definition at line 175 of file MultiTaskKernel.h.
|
inlinevirtual |
Return the parameter vector.
Reimplemented from shark::DiscreteKernel.
Definition at line 160 of file MultiTaskKernel.h.
|
inlinevirtual |
From ISerializable.
Reimplemented from shark::DiscreteKernel.
Definition at line 205 of file MultiTaskKernel.h.
|
inline |
Definition at line 189 of file MultiTaskKernel.h.
References SHARK_ASSERT.
|
inlinevirtual |
Set the parameter vector.
Reimplemented from shark::DiscreteKernel.
Definition at line 164 of file MultiTaskKernel.h.
|
inline |
Set the kernel width (equivalent to setting the bandwidth).
The bandwidth gamma and the width sigma are connected: \( gamma = 1 / (2 \cdot sigma^2) \).
Definition at line 198 of file MultiTaskKernel.h.
References SHARK_ASSERT.
|
inline |
Kernel width parameter, equivalent to the bandwidth parameter.
The bandwidth gamma and the width sigma are connected: \( gamma = 1 / (2 \cdot sigma^2) \).
Definition at line 185 of file MultiTaskKernel.h.
|
inlinevirtual |
From ISerializable.
Reimplemented from shark::DiscreteKernel.
Definition at line 212 of file MultiTaskKernel.h.
|
protected |
multi-task data
Definition at line 281 of file MultiTaskKernel.h.
|
protected |
bandwidth of the Gaussian task kernel
Definition at line 283 of file MultiTaskKernel.h.
|
protected |
kernel on inputs
Definition at line 282 of file MultiTaskKernel.h.