CSparseGaussianKernel Class Reference


Detailed Description

The well known Gaussian kernel (swiss army knife for SVMs) on sparse real valued features.

It is computed as

\[ k({\bf x},{\bf x'})= exp(-\frac{||{\bf x}-{\bf x'}||^2}{\tau}) \]

where $\tau$ is the kernel width.

Definition at line 29 of file SparseGaussianKernel.h.

Inheritance diagram for CSparseGaussianKernel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CSparseGaussianKernel (int32_t size, float64_t width)
 CSparseGaussianKernel (CSparseFeatures< float64_t > *l, CSparseFeatures< float64_t > *r, float64_t width)
virtual ~CSparseGaussianKernel ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual void cleanup ()
virtual bool load_init (FILE *src)
virtual bool save_init (FILE *dest)
virtual EKernelType get_kernel_type ()
virtual EFeatureType get_feature_type ()
virtual const char * get_name () const

Protected Member Functions

virtual float64_t compute (int32_t idx_a, int32_t idx_b)

Protected Attributes

float64_t width
float64_tsq_lhs
float64_tsq_rhs

Constructor & Destructor Documentation

CSparseGaussianKernel::CSparseGaussianKernel ( int32_t  size,
float64_t  width 
)

constructor

Parameters:
size cache size
width width

Definition at line 17 of file SparseGaussianKernel.cpp.

CSparseGaussianKernel::CSparseGaussianKernel ( CSparseFeatures< float64_t > *  l,
CSparseFeatures< float64_t > *  r,
float64_t  width 
)

constructor

Parameters:
l features of left-hand side
r features of right-hand side
width width

Definition at line 22 of file SparseGaussianKernel.cpp.

CSparseGaussianKernel::~CSparseGaussianKernel (  )  [virtual]

Definition at line 29 of file SparseGaussianKernel.cpp.


Member Function Documentation

void CSparseGaussianKernel::cleanup (  )  [virtual]

clean up kernel

Reimplemented from CKernel.

Definition at line 54 of file SparseGaussianKernel.cpp.

float64_t CSparseGaussianKernel::compute ( int32_t  idx_a,
int32_t  idx_b 
) [protected, virtual]

compute kernel function for features a and b idx_{a,b} denote the index of the feature vectors in the corresponding feature object

Parameters:
idx_a index a
idx_b index b
Returns:
computed kernel function at indices a,b

Implements CKernel.

Definition at line 76 of file SparseGaussianKernel.cpp.

virtual EFeatureType CSparseGaussianKernel::get_feature_type (  )  [virtual]

return feature type the kernel can deal with

Returns:
feature type DREAL

Reimplemented from CSparseKernel< float64_t >.

Definition at line 86 of file SparseGaussianKernel.h.

virtual EKernelType CSparseGaussianKernel::get_kernel_type (  )  [virtual]

return what type of kernel we are

Returns:
kernel type SPARSEGAUSSIAN

Implements CKernel.

Definition at line 80 of file SparseGaussianKernel.h.

virtual const char* CSparseGaussianKernel::get_name (  )  const [virtual]

return the kernel's name

Returns:
name SparseGaussian

Implements CSGObject.

Definition at line 92 of file SparseGaussianKernel.h.

bool CSparseGaussianKernel::init ( CFeatures l,
CFeatures r 
) [virtual]

initialize kernel

Parameters:
l features of left-hand side
r features of right-hand side
Returns:
if initializing was successful

free sq_{r,l}hs first

Reimplemented from CSparseKernel< float64_t >.

Definition at line 34 of file SparseGaussianKernel.cpp.

bool CSparseGaussianKernel::load_init ( FILE *  src  )  [virtual]

load kernel init_data

Parameters:
src file to load from
Returns:
if loading was successful

Implements CKernel.

Definition at line 66 of file SparseGaussianKernel.cpp.

bool CSparseGaussianKernel::save_init ( FILE *  dest  )  [virtual]

save kernel init_data

Parameters:
dest file to save to
Returns:
if saving was successful

Implements CKernel.

Definition at line 71 of file SparseGaussianKernel.cpp.


Member Data Documentation

squared left-hand side

Definition at line 109 of file SparseGaussianKernel.h.

squared right-hand side

Definition at line 111 of file SparseGaussianKernel.h.

width

Definition at line 107 of file SparseGaussianKernel.h.


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

SHOGUN Machine Learning Toolbox - Documentation