Modified Kernel Gram matrix. More...
#include <shark/LinAlg/ModifiedKernelMatrix.h>
Public Types | |
typedef Matrix::QpFloatType | QpFloatType |
Public Member Functions | |
ModifiedKernelMatrix (AbstractKernelFunction< InputType > const &kernelfunction, LabeledData< InputType, unsigned int > const &data, QpFloatType modifierEq, QpFloatType modifierNe) | |
QpFloatType | operator() (std::size_t i, std::size_t j) const |
return a single matrix entry More... | |
QpFloatType | entry (std::size_t i, std::size_t j) const |
return a single matrix entry More... | |
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 | 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... | |
Protected Attributes | |
Matrix | m_matrix |
Kernel matrix which computes the basic entries. More... | |
std::vector< unsigned int > | m_labels |
QpFloatType | m_modifierEq |
modifier in case the labels are equal More... | |
QpFloatType | m_modifierNe |
modifier in case the labels differ More... | |
Modified Kernel Gram matrix.
Definition at line 60 of file ModifiedKernelMatrix.h.
typedef Matrix::QpFloatType shark::ModifiedKernelMatrix< InputType, CacheType >::QpFloatType |
Definition at line 65 of file ModifiedKernelMatrix.h.
|
inline |
Constructor
kernelfunction | kernel function |
data | data to evaluate the kernel function |
modifierEq | multiplier for same-class labels |
modifierNe | multiplier for different-class kernels |
Definition at line 72 of file ModifiedKernelMatrix.h.
References shark::LabeledData< InputT, LabelT >::element(), and shark::ModifiedKernelMatrix< InputType, CacheType >::m_labels.
|
inline |
return a single matrix entry
Definition at line 91 of file ModifiedKernelMatrix.h.
References shark::ModifiedKernelMatrix< InputType, CacheType >::m_labels, shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix, shark::ModifiedKernelMatrix< InputType, CacheType >::m_modifierEq, and shark::ModifiedKernelMatrix< InputType, CacheType >::m_modifierNe.
Referenced by shark::ModifiedKernelMatrix< InputType, CacheType >::operator()().
|
inline |
swap two variables
Definition at line 128 of file ModifiedKernelMatrix.h.
References shark::KernelMatrix< InputType, CacheType >::flipColumnsAndRows(), shark::ModifiedKernelMatrix< InputType, CacheType >::m_labels, shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix, and shark::swap().
|
inline |
query the kernel access counter
Definition at line 138 of file ModifiedKernelMatrix.h.
References shark::KernelMatrix< InputType, CacheType >::getAccessCount(), and shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix.
|
inline |
Computes the kernel-matrix.
Definition at line 114 of file ModifiedKernelMatrix.h.
References shark::ModifiedKernelMatrix< InputType, CacheType >::m_labels, shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix, shark::ModifiedKernelMatrix< InputType, CacheType >::m_modifierEq, shark::ModifiedKernelMatrix< InputType, CacheType >::m_modifierNe, shark::KernelMatrix< InputType, CacheType >::matrix(), and shark::ModifiedKernelMatrix< InputType, CacheType >::size().
|
inline |
return a single matrix entry
Definition at line 87 of file ModifiedKernelMatrix.h.
References shark::ModifiedKernelMatrix< InputType, CacheType >::entry().
|
inline |
reset the kernel access counter
Definition at line 142 of file ModifiedKernelMatrix.h.
References shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix, and shark::KernelMatrix< InputType, CacheType >::resetAccessCount().
|
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 102 of file ModifiedKernelMatrix.h.
References shark::ModifiedKernelMatrix< InputType, CacheType >::m_labels, shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix, shark::ModifiedKernelMatrix< InputType, CacheType >::m_modifierEq, shark::ModifiedKernelMatrix< InputType, CacheType >::m_modifierNe, and shark::KernelMatrix< InputType, CacheType >::row().
|
inline |
return the size of the quadratic matrix
Definition at line 134 of file ModifiedKernelMatrix.h.
References shark::ModifiedKernelMatrix< InputType, CacheType >::m_matrix, and shark::KernelMatrix< InputType, CacheType >::size().
Referenced by shark::ModifiedKernelMatrix< InputType, CacheType >::matrix().
|
protected |
Definition at line 148 of file ModifiedKernelMatrix.h.
Referenced by shark::ModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ModifiedKernelMatrix< InputType, CacheType >::flipColumnsAndRows(), shark::ModifiedKernelMatrix< InputType, CacheType >::matrix(), shark::ModifiedKernelMatrix< InputType, CacheType >::ModifiedKernelMatrix(), and shark::ModifiedKernelMatrix< InputType, CacheType >::row().
|
protected |
Kernel matrix which computes the basic entries.
Definition at line 147 of file ModifiedKernelMatrix.h.
Referenced by shark::ModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ModifiedKernelMatrix< InputType, CacheType >::flipColumnsAndRows(), shark::ModifiedKernelMatrix< InputType, CacheType >::getAccessCount(), shark::ModifiedKernelMatrix< InputType, CacheType >::matrix(), shark::ModifiedKernelMatrix< InputType, CacheType >::resetAccessCount(), shark::ModifiedKernelMatrix< InputType, CacheType >::row(), and shark::ModifiedKernelMatrix< InputType, CacheType >::size().
|
protected |
modifier in case the labels are equal
Definition at line 151 of file ModifiedKernelMatrix.h.
Referenced by shark::ModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ModifiedKernelMatrix< InputType, CacheType >::matrix(), and shark::ModifiedKernelMatrix< InputType, CacheType >::row().
|
protected |
modifier in case the labels differ
Definition at line 154 of file ModifiedKernelMatrix.h.
Referenced by shark::ModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ModifiedKernelMatrix< InputType, CacheType >::matrix(), and shark::ModifiedKernelMatrix< InputType, CacheType >::row().