#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 | |
| void | flipColumnsAndRows (std::size_t i, std::size_t j) |
| swap two variables | |
| std::size_t | size () const |
| return the size of the quadratic matrix | |
| unsigned long long | getAccessCount () const |
| query the kernel access counter | |
| void | resetAccessCount () |
| reset the kernel access counter | |
| 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. | |
| template<class M > | |
| void | matrix (blas::matrix_expression< M, blas::cpu_tag > &storage) const |
| Computes the kernel-matrix. | |
| 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. | |
| std::vector< PointerType > | x |
| Array of data pointers for kernel evaluations. | |
| unsigned long long | m_accessCounter |
| counter for the kernel accesses | |
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.
Definition at line 60 of file ExampleModifiedKernelMatrix.h.
|
protected |
Definition at line 148 of file ExampleModifiedKernelMatrix.h.
| typedef CacheType shark::ExampleModifiedKernelMatrix< InputType, CacheType >::QpFloatType |
Definition at line 63 of file ExampleModifiedKernelMatrix.h.
|
inline |
Constructor
| kernelfunction | kernel function defining the Gram matrix |
| data | data 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.
|
inline |
return a single matrix entry Override the Base::entry(...) formula: \( K\left(x_i, x_j\right)\frac{1}{s_i}\frac{1}{s_j} \)
Definition at line 102 of file ExampleModifiedKernelMatrix.h.
References shark::evalSkipMissingFeatures(), INCREMENT_KERNEL_COUNTER, shark::ExampleModifiedKernelMatrix< InputType, CacheType >::kernel, shark::ExampleModifiedKernelMatrix< InputType, CacheType >::m_accessCounter, shark::ExampleModifiedKernelMatrix< InputType, CacheType >::size(), SIZE_CHECK, and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::x.
Referenced by shark::ExampleModifiedKernelMatrix< InputType, CacheType >::matrix(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::operator()(), and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::row().
|
inline |
swap two variables
Definition at line 84 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::x.
|
inline |
query the kernel access counter
Definition at line 92 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::m_accessCounter.
|
inline |
Computes the kernel-matrix.
Definition at line 127 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry(), and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::size().
|
inline |
return a single matrix entry
Definition at line 80 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry().
|
inline |
reset the kernel access counter
Definition at line 96 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::m_accessCounter.
|
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().
|
inline |
Definition at line 137 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::size(), and SIZE_CHECK.
|
inline |
return the size of the quadratic matrix
Definition at line 88 of file ExampleModifiedKernelMatrix.h.
References shark::ExampleModifiedKernelMatrix< InputType, CacheType >::x.
Referenced by shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::matrix(), and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::setScalingCoefficients().
|
protected |
Kernel function defining the kernel Gram matrix.
Definition at line 146 of file ExampleModifiedKernelMatrix.h.
Referenced by shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry().
|
mutableprotected |
counter for the kernel accesses
Definition at line 152 of file ExampleModifiedKernelMatrix.h.
Referenced by shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::getAccessCount(), and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::resetAccessCount().
|
protected |
Array of data pointers for kernel evaluations.
Definition at line 150 of file ExampleModifiedKernelMatrix.h.
Referenced by shark::ExampleModifiedKernelMatrix< InputType, CacheType >::entry(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::ExampleModifiedKernelMatrix(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::flipColumnsAndRows(), and shark::ExampleModifiedKernelMatrix< InputType, CacheType >::size().