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
CRidgeKernelNormalizer Class Reference

Detailed Description

Normalize the kernel by adding a constant term to its diagonal. This aids kernels to become positive definite (even though they are not - often caused by numerical problems).

Formally,

\[ k'(x,x')= \frac{k(x,x')}+ R\cdot {\bf E} \]

where E is a matrix with ones on the diagonal and R is the scalar ridge term. The ridge term R is computed as $R=r\dot c$.

Typically,

In case c <= 0, c is compute as the mean of the kernel diagonal

\[ \mbox{c} = \frac{1}{N}\sum_{i=1}^N k(x_i,x_i) \]

Definition at line 43 of file RidgeKernelNormalizer.h.

Inheritance diagram for CRidgeKernelNormalizer:
Inheritance graph
[legend]

Public Member Functions

 CRidgeKernelNormalizer (float64_t r=1e-10, float64_t c=0.0)
virtual ~CRidgeKernelNormalizer ()
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)
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_t ridge
 the constant ridge to be added to the kernel diagonal
float64_t scale
 scaling parameter (avg of diagonal)
- 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

CRidgeKernelNormalizer ( float64_t  r = 1e-10,
float64_t  c = 0.0 
)

constructor

Parameters
rridge parameter
cscale parameter, if <= 0 scaling will be computed from the avg of the kernel diagonal elements

the scalar r*c will be added to the kernel diagonal, typical use cases:

  • r=1e-10 and c=0.0 will add mean(diag(K))*1e-10 to the diagonal
  • r=0.1 and c=1 will add 0.1 to the diagonal

Definition at line 56 of file RidgeKernelNormalizer.h.

virtual ~CRidgeKernelNormalizer ( )
virtual

default destructor

Definition at line 68 of file RidgeKernelNormalizer.h.

Member Function Documentation

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

Implements CSGObject.

Definition at line 135 of file RidgeKernelNormalizer.h.

virtual bool init ( CKernel k)
virtual

initialization of the normalizer (if needed)

Parameters
kkernel

Implements CKernelNormalizer.

Definition at line 74 of file RidgeKernelNormalizer.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 105 of file RidgeKernelNormalizer.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 118 of file RidgeKernelNormalizer.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 128 of file RidgeKernelNormalizer.h.

Member Data Documentation

float64_t ridge
protected

the constant ridge to be added to the kernel diagonal

Definition at line 139 of file RidgeKernelNormalizer.h.

float64_t scale
protected

scaling parameter (avg of diagonal)

Definition at line 141 of file RidgeKernelNormalizer.h.


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

SHOGUN Machine Learning Toolbox - Documentation