The Custom Kernel allows for custom user provided kernel matrices.
For squared training matrices it allows to store only the upper triangle of the kernel to save memory: Full symmetric kernel matrices can be stored as is or can be internally converted into (or directly given in) upper triangle representation. Also note that values are stored as 32bit floats.
Definition at line 29 of file CustomKernel.h.
CCustomKernel | ( | ) |
default constructor
Definition at line 26 of file CustomKernel.cpp.
CCustomKernel | ( | CKernel * | k | ) |
constructor
compute custom kernel from given kernel matrix
k | kernel matrix |
Definition at line 32 of file CustomKernel.cpp.
CCustomKernel | ( | SGMatrix< float64_t > | km | ) |
constructor
sets full kernel matrix from full kernel matrix (from double precision floats)
km | kernel matrix |
Definition at line 38 of file CustomKernel.cpp.
~CCustomKernel | ( | ) | [virtual] |
Definition at line 45 of file CustomKernel.cpp.
void cleanup | ( | ) | [virtual] |
virtual float64_t compute | ( | int32_t | row, | |
int32_t | col | |||
) | [protected, virtual] |
compute kernel function
row | row | |
col | col |
Implements CKernel.
Definition at line 288 of file CustomKernel.h.
bool dummy_init | ( | int32_t | rows, | |
int32_t | cols | |||
) | [virtual] |
initialize kernel with dummy features
Kernels always need feature objects assigned. As the custom kernel does not really require this it creates some magic dummy features that only know about the number of vectors
rows | features of left-hand side | |
cols | features of right-hand side |
Definition at line 50 of file CustomKernel.cpp.
virtual EFeatureClass get_feature_class | ( | ) | [virtual] |
return feature class the kernel can deal with
Implements CKernel.
Definition at line 97 of file CustomKernel.h.
virtual EFeatureType get_feature_type | ( | ) | [virtual] |
return feature type the kernel can deal with
Implements CKernel.
Definition at line 91 of file CustomKernel.h.
virtual EKernelType get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are
Implements CKernel.
Definition at line 85 of file CustomKernel.h.
virtual const char* get_name | ( | void | ) | const [virtual] |
return the kernel's name
Implements CSGObject.
Definition at line 103 of file CustomKernel.h.
virtual int32_t get_num_vec_lhs | ( | ) | [virtual] |
get number of vectors of lhs features
Reimplemented from CKernel.
Definition at line 257 of file CustomKernel.h.
virtual int32_t get_num_vec_rhs | ( | ) | [virtual] |
get number of vectors of rhs features
Reimplemented from CKernel.
Definition at line 266 of file CustomKernel.h.
virtual bool has_features | ( | ) | [virtual] |
test whether features have been assigned to lhs and rhs
Reimplemented from CKernel.
Definition at line 275 of file CustomKernel.h.
initialize kernel
l | features of left-hand side | |
r | features of right-hand side |
Reimplemented from CKernel.
Definition at line 55 of file CustomKernel.cpp.
set full kernel matrix from full kernel matrix
for float64
Definition at line 229 of file CustomKernel.h.
set full kernel matrix from full kernel matrix
for float32
Definition at line 212 of file CustomKernel.h.
set kernel matrix (only elements from upper triangle) from squared matrix
for float64's
Definition at line 166 of file CustomKernel.h.
bool set_triangle_kernel_matrix_from_full_generic | ( | SGMatrix< T > | full_kernel_matrix | ) |
set kernel matrix (only elements from upper triangle) from squared matrix
Definition at line 178 of file CustomKernel.h.
set kernel matrix (only elements from upper triangle) from elements of upper triangle (concat'd), including the main diagonal
small variant for floats64's, triangle needs to have less than 2**32 elements
tri_kernel_matrix | tri kernel matrix |
Definition at line 114 of file CustomKernel.h.
bool set_triangle_kernel_matrix_from_triangle_generic | ( | SGVector< T > | tri_kernel_matrix | ) |
set kernel matrix (only elements from upper triangle) from elements of upper triangle (concat'd), including the main diagonal
big variant, allowing the triangle to have more than 2**31-1 elements
tri_kernel_matrix | tri kernel matrix |
Definition at line 130 of file CustomKernel.h.
kernel matrix
Definition at line 320 of file CustomKernel.h.
bool upper_diagonal [protected] |
upper diagonal
Definition at line 323 of file CustomKernel.h.