shark::ExampleModifiedKernelMatrix< InputType, CacheType > Class Template Reference

#include <shark/LinAlg/ExampleModifiedKernelMatrix.h>

Public Types

typedef CacheType QpFloatType
 

Public Member Functions

 ExampleModifiedKernelMatrix (AbstractKernelFunction< InputType > const &kernelfunction, Data< InputType > const &data)
 
QpFloatType operator() (std::size_t i, std::size_t j) const
 return a single matrix entry More...
 
void flipColumnsAndRows (std::size_t i, std::size_t j)
 swap two variables More...
 
std::size_t size () const
 return the size of the quadratic matrix More...
 
unsigned long long getAccessCount () const
 query the kernel access counter More...
 
void resetAccessCount ()
 reset the kernel access counter More...
 
QpFloatType entry (std::size_t i, std::size_t j) const
 
void row (std::size_t i, std::size_t start, std::size_t end, QpFloatType *storage) const
 Computes the i-th row of the kernel matrix. More...
 
template<class M >
void matrix (blas::matrix_expression< M, blas::cpu_tag > &storage) const
 Computes the kernel-matrix. More...
 
void setScalingCoefficients (const RealVector &scalingCoefficients)
 

Protected Types

typedef Data< InputType >::const_element_range::const_iterator PointerType
 

Protected Attributes

AbstractKernelFunction< InputType > const & kernel
 Kernel function defining the kernel Gram matrix. More...
 
std::vector< PointerTypex
 Array of data pointers for kernel evaluations. More...
 
unsigned long long m_accessCounter
 counter for the kernel accesses More...
 

Detailed Description

template<typename InputType, typename CacheType>
class shark::ExampleModifiedKernelMatrix< InputType, CacheType >

Kernel matrix which supports kernel evaluations on data with missing features. At the same time, the entry of the Gram matrix between examples i and j can be multiplied by two scaling factors corresponding to the examples i and j, respectively. To this end, this class holds a vector of as many scaling coefficients as there are examples in the dataset.

Note
: most of code in this class is borrowed from KernelMatrix by copy/paste, which is obviously terribly ugly. We could/should refactor classes in this file as soon as possible.

Definition at line 60 of file ExampleModifiedKernelMatrix.h.

Member Typedef Documentation

◆ PointerType

template<typename InputType , typename CacheType >
typedef Data<InputType>::const_element_range::const_iterator shark::ExampleModifiedKernelMatrix< InputType, CacheType >::PointerType
protected

Definition at line 148 of file ExampleModifiedKernelMatrix.h.

◆ QpFloatType

template<typename InputType , typename CacheType >
typedef CacheType shark::ExampleModifiedKernelMatrix< InputType, CacheType >::QpFloatType

Definition at line 63 of file ExampleModifiedKernelMatrix.h.

Constructor & Destructor Documentation

◆ ExampleModifiedKernelMatrix()

template<typename InputType , typename CacheType >
shark::ExampleModifiedKernelMatrix< InputType, CacheType >::ExampleModifiedKernelMatrix ( AbstractKernelFunction< InputType > const &  kernelfunction,
Data< InputType > const &  data 
)
inline

Constructor

Parameters
kernelfunctionkernel function defining the Gram matrix
datadata to evaluate the kernel function

Definition at line 68 of file ExampleModifiedKernelMatrix.h.

References shark::Data< Type >::elements(), shark::Data< Type >::numberOfElements(), and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::x.

Member Function Documentation

◆ entry()

◆ flipColumnsAndRows()

template<typename InputType , typename CacheType >
void shark::ExampleModifiedKernelMatrix< InputType, CacheType >::flipColumnsAndRows ( std::size_t  i,
std::size_t  j 
)
inline

◆ getAccessCount()

template<typename InputType , typename CacheType >
unsigned long long shark::ExampleModifiedKernelMatrix< InputType, CacheType >::getAccessCount ( ) const
inline

query the kernel access counter

Definition at line 92 of file ExampleModifiedKernelMatrix.h.

References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::m_accessCounter.

◆ matrix()

template<typename InputType , typename CacheType >
template<class M >
void shark::ExampleModifiedKernelMatrix< InputType, CacheType >::matrix ( blas::matrix_expression< M, blas::cpu_tag > &  storage) const
inline

◆ operator()()

template<typename InputType , typename CacheType >
QpFloatType shark::ExampleModifiedKernelMatrix< InputType, CacheType >::operator() ( std::size_t  i,
std::size_t  j 
) const
inline

return a single matrix entry

Definition at line 80 of file ExampleModifiedKernelMatrix.h.

References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry().

◆ resetAccessCount()

template<typename InputType , typename CacheType >
void shark::ExampleModifiedKernelMatrix< InputType, CacheType >::resetAccessCount ( )
inline

reset the kernel access counter

Definition at line 96 of file ExampleModifiedKernelMatrix.h.

References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::m_accessCounter.

◆ row()

template<typename InputType , typename CacheType >
void shark::ExampleModifiedKernelMatrix< InputType, CacheType >::row ( std::size_t  i,
std::size_t  start,
std::size_t  end,
QpFloatType storage 
) const
inline

Computes the i-th row of the kernel matrix.

The entries start,...,end of the i-th row are computed and stored in storage. There must be enough room for this operation preallocated.

Definition at line 119 of file ExampleModifiedKernelMatrix.h.

References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry().

◆ setScalingCoefficients()

template<typename InputType , typename CacheType >
void shark::ExampleModifiedKernelMatrix< InputType, CacheType >::setScalingCoefficients ( const RealVector &  scalingCoefficients)
inline

◆ size()

Member Data Documentation

◆ kernel

template<typename InputType , typename CacheType >
AbstractKernelFunction<InputType> const& shark::ExampleModifiedKernelMatrix< InputType, CacheType >::kernel
protected

Kernel function defining the kernel Gram matrix.

Definition at line 146 of file ExampleModifiedKernelMatrix.h.

Referenced by shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry().

◆ m_accessCounter

template<typename InputType , typename CacheType >
unsigned long long shark::ExampleModifiedKernelMatrix< InputType, CacheType >::m_accessCounter
mutableprotected

◆ x


The documentation for this class was generated from the following file: