The well known Gaussian kernel (swiss army knife for SVMs) on sparse real valued features.
It is computed as
where is the kernel width.
Definition at line 32 of file SparseGaussianKernel.h.
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 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_t * | sq_lhs |
float64_t * | sq_rhs |
CSparseGaussianKernel | ( | int32_t | size, | |
float64_t | width | |||
) |
constructor
size | cache size | |
width | width |
Definition at line 19 of file SparseGaussianKernel.cpp.
CSparseGaussianKernel | ( | CSparseFeatures< float64_t > * | l, | |
CSparseFeatures< float64_t > * | r, | |||
float64_t | width | |||
) |
constructor
l | features of left-hand side | |
r | features of right-hand side | |
width | width |
Definition at line 24 of file SparseGaussianKernel.cpp.
~CSparseGaussianKernel | ( | ) | [virtual] |
Definition at line 31 of file SparseGaussianKernel.cpp.
void cleanup | ( | ) | [virtual] |
float64_t 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
idx_a | index a | |
idx_b | index b |
Implements CKernel.
Definition at line 68 of file SparseGaussianKernel.cpp.
virtual EFeatureType get_feature_type | ( | ) | [virtual] |
return feature type the kernel can deal with
Reimplemented from CSparseKernel< float64_t >.
Definition at line 75 of file SparseGaussianKernel.h.
virtual EKernelType get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are
Implements CKernel.
Definition at line 69 of file SparseGaussianKernel.h.
virtual const char* get_name | ( | ) | const [virtual] |
return the kernel's name
Implements CSGObject.
Definition at line 81 of file SparseGaussianKernel.h.
initialize kernel
l | features of left-hand side | |
r | features of right-hand side |
free sq_{r,l}hs first
Reimplemented from CSparseKernel< float64_t >.
Definition at line 36 of file SparseGaussianKernel.cpp.
squared left-hand side
Definition at line 98 of file SparseGaussianKernel.h.
squared right-hand side
Definition at line 100 of file SparseGaussianKernel.h.
width
Definition at line 96 of file SparseGaussianKernel.h.