SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
CZeroMeanCenterKernelNormalizer Class Reference

Detailed Description

ZeroMeanCenterKernelNormalizer centers the kernel in feature space.

After centering, each feature must have zero mean. The centered kernel matrix can be expressed in terms of the non-centered version.

Denoting the mapping from input space to feature space by $\phi:\mathcal{X}\rightarrow\mathcal{F}$, the centered square kernel matrix $K_c$ (with dimensionality $ M $)

can be expressed in terms of the original matrix $K$ as follows:

\begin{eqnarray*} k({\bf x}_i,{\bf x}_j)_c & = & \left(\phi({\bf x}_i) - \frac{1}{m} \sum_{p=1}^M \phi({\bf x}_p)\right) \cdot \left(\phi({\bf x}_j) - \frac{1}{M} \sum_{q=1}^M \phi({\bf x}_q)\right) \\ & = & K_{ij} - \frac{1}{M} \sum_{p=1}^M K_{pj} - \frac{1}{M} \sum_{q=1}^M K_{iq} + \frac{1}{M^2} \sum_{p=1}^M \sum_{q=1}^M K_{pq} \\ & = & (K - 1_M K - K 1_M + 1_M K 1_M)_{ij} \end{eqnarray*}

Additionally, let $ K^{t} $ be the $ L \times M $ test matrix describing the similarity between a $ L $ test instances with $M$ training instances

(defined by a $ M x M $ kernel matrix $ K$), the centered testing set kernel matrix is given by

\[ K_{c}^t = (K - 1'_M K - K^{t} 1_M + 1'_M K 1_M) \]

Definition at line 41 of file ZeroMeanCenterKernelNormalizer.h.

Inheritance diagram for CZeroMeanCenterKernelNormalizer:
Inheritance graph
[legend]

Public Member Functions

 CZeroMeanCenterKernelNormalizer ()
virtual ~CZeroMeanCenterKernelNormalizer ()
virtual bool init (CKernel *k)
virtual float64_t normalize (float64_t value, int32_t idx_lhs, int32_t idx_rhs)
virtual float64_t normalize_lhs (float64_t value, int32_t idx_lhs)
virtual float64_t normalize_rhs (float64_t value, int32_t idx_rhs)
bool alloc_and_compute_row_means (CKernel *k, float64_t *&v, int32_t num_lhs, int32_t num_rhs)
virtual const char * get_name () const
- Public Member Functions inherited from CKernelNormalizer
 CKernelNormalizer ()
virtual ~CKernelNormalizer ()
virtual void register_params ()
ENormalizerType get_normalizer_type ()
void set_normalizer_type (ENormalizerType type)
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Protected Attributes

float64_tktrain_row_means
int32_t num_ktrain
float64_tktest_row_means
int32_t num_ktest
float64_t ktrain_mean
- Protected Attributes inherited from CKernelNormalizer
ENormalizerType m_type

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

Constructor & Destructor Documentation

default constructor

Definition at line 46 of file ZeroMeanCenterKernelNormalizer.h.

virtual ~CZeroMeanCenterKernelNormalizer ( )
virtual

default destructor

Definition at line 57 of file ZeroMeanCenterKernelNormalizer.h.

Member Function Documentation

bool alloc_and_compute_row_means ( CKernel k,
float64_t *&  v,
int32_t  num_lhs,
int32_t  num_rhs 
)

alloc and compute the vector containing the row margins of all rows for a kernel matrix.

Definition at line 135 of file ZeroMeanCenterKernelNormalizer.h.

virtual const char* get_name ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 150 of file ZeroMeanCenterKernelNormalizer.h.

virtual bool init ( CKernel k)
virtual

initialization of the normalizer

Parameters
kkernel

Implements CKernelNormalizer.

Definition at line 65 of file ZeroMeanCenterKernelNormalizer.h.

virtual float64_t normalize ( float64_t  value,
int32_t  idx_lhs,
int32_t  idx_rhs 
)
virtual

normalize the kernel value

Parameters
valuekernel value
idx_lhsindex of left hand side vector
idx_rhsindex of right hand side vector

Implements CKernelNormalizer.

Definition at line 104 of file ZeroMeanCenterKernelNormalizer.h.

virtual float64_t normalize_lhs ( float64_t  value,
int32_t  idx_lhs 
)
virtual

normalize only the left hand side vector

Parameters
valuevalue of a component of the left hand side feature vector
idx_lhsindex of left hand side vector

Implements CKernelNormalizer.

Definition at line 115 of file ZeroMeanCenterKernelNormalizer.h.

virtual float64_t normalize_rhs ( float64_t  value,
int32_t  idx_rhs 
)
virtual

normalize only the right hand side vector

Parameters
valuevalue of a component of the right hand side feature vector
idx_rhsindex of right hand side vector

Implements CKernelNormalizer.

Definition at line 125 of file ZeroMeanCenterKernelNormalizer.h.

Member Data Documentation

float64_t* ktest_row_means
protected

test row means

Definition at line 160 of file ZeroMeanCenterKernelNormalizer.h.

float64_t ktrain_mean
protected

train mean

Definition at line 166 of file ZeroMeanCenterKernelNormalizer.h.

float64_t* ktrain_row_means
protected

train row means

Definition at line 154 of file ZeroMeanCenterKernelNormalizer.h.

int32_t num_ktest
protected

num k test

Definition at line 163 of file ZeroMeanCenterKernelNormalizer.h.

int32_t num_ktrain
protected

num k train

Definition at line 157 of file ZeroMeanCenterKernelNormalizer.h.


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

SHOGUN Machine Learning Toolbox - Documentation