yat  0.14.5pre
Public Member Functions | Protected Attributes | List of all members
theplu::yat::classifier::Kernel_MEV Class Reference

Memory Efficient Kernel. More...

#include <yat/classifier/Kernel_MEV.h>

Inheritance diagram for theplu::yat::classifier::Kernel_MEV:
theplu::yat::classifier::Kernel

Public Member Functions

 Kernel_MEV (const MatrixLookup &data, const KernelFunction &kf, const bool own=false)
 
 Kernel_MEV (const MatrixLookupWeighted &data, const KernelFunction &kf, const bool own=false)
 
 Kernel_MEV (const Kernel_MEV &kernel, const std::vector< size_t > &index)
 
double operator() (const size_t row, const size_t column) const
 
const Kernel_MEVmake_kernel (const MatrixLookup &, const bool own=false) const
 
const Kernel_MEVmake_kernel (const MatrixLookupWeighted &, const bool own=false) const
 
const MatrixLookupdata (void) const
 
const MatrixLookupWeighteddata_weighted (void) const
 
double element (const DataLookup1D &vec, const size_t i) const
 
double element (const DataLookupWeighted1D &vec, const size_t i) const
 
size_t size (void) const
 number of samples
 
bool weighted (void) const
 

Protected Attributes

const MatrixLookupml_
 underlying data
 
const MatrixLookupWeightedmlw_
 same as data_ if weifghted otherwise a NULL pointer
 
const KernelFunctionkf_
 type of Kernel Function e.g. Gaussian (aka RBF)
 
unsigned int * ref_count_
 
unsigned int * ref_count_w_
 

Detailed Description

Memory Efficient Kernel.

Class taking care of the $ NxN $ kernel matrix, where $ N $ is number of samples. Type of Kernel is defined by a KernelFunction. This Memory Efficient Version (MEV) does not store the kernel matrix in memory, but calculates an element when it is needed. When memory allows do always use Kernel_SEV instead.

Constructor & Destructor Documentation

theplu::yat::classifier::Kernel_MEV::Kernel_MEV ( const MatrixLookup data,
const KernelFunction kf,
const bool  own = false 
)

Constructor taking the data matrix and KernelFunction as input. Each column in the data matrix corresponds to one sample.

Note
Can not handle NaNs.
theplu::yat::classifier::Kernel_MEV::Kernel_MEV ( const MatrixLookupWeighted data,
const KernelFunction kf,
const bool  own = false 
)

Constructor taking the data matrix and KernelFunction as input. Each column in the data matrix corresponds to one sample.

Note
Can not handle NaNs.
theplu::yat::classifier::Kernel_MEV::Kernel_MEV ( const Kernel_MEV kernel,
const std::vector< size_t > &  index 
)

Constructing a new Kernel based on selected features index. All other seeting are the same.

Member Function Documentation

const MatrixLookup& theplu::yat::classifier::Kernel::data ( void  ) const
inherited
Returns
const reference to the underlying data.
Exceptions
ifdata is weighted
const MatrixLookupWeighted& theplu::yat::classifier::Kernel::data_weighted ( void  ) const
inherited
Returns
const reference to the underlying data.
Exceptions
ifdata is unweighted
double theplu::yat::classifier::Kernel::element ( const DataLookup1D vec,
const size_t  i 
) const
inherited

Calculates the scalar product (using the KernelFunction) between vector vec and the $ i $ th column in the data matrix.

double theplu::yat::classifier::Kernel::element ( const DataLookupWeighted1D vec,
const size_t  i 
) const
inherited

Calculates the weighted scalar product (using the KernelFunction) between vector vec and the $ i $ th column in the data matrix. Using a weight vector with all elements equal to unity yields same result as the non-weighted version above.

const Kernel_MEV* theplu::yat::classifier::Kernel_MEV::make_kernel ( const MatrixLookup ,
const bool  own = false 
) const
virtual

An interface for making new classifier objects. This function allows for specification at run-time of which kernel to instatiate (see 'Prototype' in Design Patterns).

Note
Returns a dynamically allocated Kernel, which has to be deleted by the caller to avoid memory leaks.

Implements theplu::yat::classifier::Kernel.

const Kernel_MEV* theplu::yat::classifier::Kernel_MEV::make_kernel ( const MatrixLookupWeighted ,
const bool  own = false 
) const
virtual

An interface for making new classifier objects. This function allows for specification at run-time of which kernel to instatiate (see 'Prototype' in Design Patterns).

Note
Returns a dynamically allocated Kernel, which has to be deleted by the caller to avoid memory leaks.

Implements theplu::yat::classifier::Kernel.

double theplu::yat::classifier::Kernel_MEV::operator() ( const size_t  row,
const size_t  column 
) const
virtual
Returns
Element at position (row, column) of the Kernel matrix

Implements theplu::yat::classifier::Kernel.

bool theplu::yat::classifier::Kernel::weighted ( void  ) const
inherited
Returns
true if kernel is calculated using weights

Member Data Documentation

unsigned int* theplu::yat::classifier::Kernel::ref_count_
protectedinherited

pointer telling how many owners to underlying data (data_). NULL if this is not an owner.

unsigned int* theplu::yat::classifier::Kernel::ref_count_w_
protectedinherited

pointer telling how many owners to underlying weights (data_w_). NULL if this is not an owner.


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

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5