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 29 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 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_t * | sq_lhs |
float64_t * | sq_rhs |
CSparseGaussianKernel::CSparseGaussianKernel | ( | int32_t | size, | |
float64_t | width | |||
) |
constructor
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
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.
void CSparseGaussianKernel::cleanup | ( | ) | [virtual] |
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
idx_a | index a | |
idx_b | index 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
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
Implements CKernel.
Definition at line 80 of file SparseGaussianKernel.h.
virtual const char* CSparseGaussianKernel::get_name | ( | ) | const [virtual] |
return the kernel's name
Implements CSGObject.
Definition at line 92 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 34 of file SparseGaussianKernel.cpp.
bool CSparseGaussianKernel::load_init | ( | FILE * | src | ) | [virtual] |
load kernel init_data
src | file to load from |
Implements CKernel.
Definition at line 66 of file SparseGaussianKernel.cpp.
bool CSparseGaussianKernel::save_init | ( | FILE * | dest | ) | [virtual] |
save kernel init_data
dest | file to save to |
Implements CKernel.
Definition at line 71 of file SparseGaussianKernel.cpp.
float64_t* CSparseGaussianKernel::sq_lhs [protected] |
squared left-hand side
Definition at line 109 of file SparseGaussianKernel.h.
float64_t* CSparseGaussianKernel::sq_rhs [protected] |
squared right-hand side
Definition at line 111 of file SparseGaussianKernel.h.
float64_t CSparseGaussianKernel::width [protected] |
width
Definition at line 107 of file SparseGaussianKernel.h.