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.
在文件CustomKernel.h第29行定义。
公有成员 | |
CCustomKernel () | |
CCustomKernel (CKernel *k) | |
CCustomKernel (const float64_t *km, int32_t rows, int32_t cols) | |
CCustomKernel (const float32_t *km, int32_t rows, int32_t cols) | |
virtual | ~CCustomKernel () |
virtual bool | dummy_init (int32_t rows, int32_t cols) |
virtual bool | init (CFeatures *l, CFeatures *r) |
virtual void | cleanup () |
virtual EKernelType | get_kernel_type () |
virtual EFeatureType | get_feature_type () |
virtual EFeatureClass | get_feature_class () |
virtual const char * | get_name () const |
bool | set_triangle_kernel_matrix_from_triangle (const float64_t *km, int32_t len) |
bool | set_triangle_kernel_matrix_from_triangle (const float32_t *km, int32_t len) |
template<class T > | |
bool | set_triangle_kernel_matrix_from_triangle_generic (const T *km, int64_t len) |
bool | set_triangle_kernel_matrix_from_full (const float64_t *km, int32_t rows, int32_t cols) |
bool | set_triangle_kernel_matrix_from_full (const float32_t *km, int32_t rows, int32_t cols) |
template<class T > | |
bool | set_triangle_kernel_matrix_from_full_generic (const T *km, int32_t rows, int32_t cols) |
bool | set_full_kernel_matrix_from_full (const float64_t *km, int32_t rows, int32_t cols) |
bool | set_full_kernel_matrix_from_full (const float32_t *km, int32_t rows, int32_t cols) |
template<class T > | |
bool | set_full_kernel_matrix_from_full_generic (const T *km, int32_t rows, int32_t cols) |
virtual int32_t | get_num_vec_lhs () |
virtual int32_t | get_num_vec_rhs () |
virtual bool | has_features () |
保护成员 | |
virtual float64_t | compute (int32_t row, int32_t col) |
保护属性 | |
float32_t * | kmatrix |
int32_t | num_rows |
int32_t | num_cols |
bool | upper_diagonal |
CCustomKernel | ( | ) |
default constructor
在文件CustomKernel.cpp第19行定义。
CCustomKernel | ( | CKernel * | k ) |
constructor
compute custom kernel from given kernel matrix
k | kernel matrix |
在文件CustomKernel.cpp第24行定义。
CCustomKernel | ( | const float64_t * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
constructor
sets full kernel matrix from full kernel matrix (from double precision floats)
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.cpp第65行定义。
CCustomKernel | ( | const float32_t * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
constructor
sets full kernel matrix from full kernel matrix (from single precision floats)
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.cpp第71行定义。
~CCustomKernel | ( | ) | [virtual] |
在文件CustomKernel.cpp第77行定义。
void cleanup | ( | ) | [virtual] |
virtual float64_t compute | ( | int32_t | row, |
int32_t | col | ||
) | [protected, virtual] |
compute kernel function
row | row |
col | col |
实现了CKernel。
在文件CustomKernel.h第358行定义。
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 |
在文件CustomKernel.cpp第82行定义。
virtual EFeatureClass get_feature_class | ( | ) | [virtual] |
return feature class the kernel can deal with
实现了CKernel。
在文件CustomKernel.h第109行定义。
virtual EFeatureType get_feature_type | ( | ) | [virtual] |
return feature type the kernel can deal with
实现了CKernel。
在文件CustomKernel.h第103行定义。
virtual EKernelType get_kernel_type | ( | ) | [virtual] |
virtual const char* get_name | ( | ) | const [virtual] |
virtual int32_t get_num_vec_lhs | ( | ) | [virtual] |
get number of vectors of lhs features
重载CKernel。
在文件CustomKernel.h第328行定义。
virtual int32_t get_num_vec_rhs | ( | ) | [virtual] |
get number of vectors of rhs features
重载CKernel。
在文件CustomKernel.h第337行定义。
virtual bool has_features | ( | ) | [virtual] |
test whether features have been assigned to lhs and rhs
重载CKernel。
在文件CustomKernel.h第346行定义。
initialize kernel
l | features of left-hand side |
r | features of right-hand side |
重载CKernel。
在文件CustomKernel.cpp第87行定义。
bool set_full_kernel_matrix_from_full | ( | const float32_t * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
set full kernel matrix from full kernel matrix
for float32's
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.h第286行定义。
bool set_full_kernel_matrix_from_full | ( | const float64_t * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
set full kernel matrix from full kernel matrix
for float64's
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.h第271行定义。
bool set_full_kernel_matrix_from_full_generic | ( | const T * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
set full kernel matrix from full kernel matrix
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.h第300行定义。
bool set_triangle_kernel_matrix_from_full | ( | const float64_t * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
set kernel matrix (only elements from upper triangle) from squared matrix
for float64's
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.h第205行定义。
bool set_triangle_kernel_matrix_from_full | ( | const float32_t * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
set kernel matrix (only elements from upper triangle) from squared matrix
for float32's
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.h第221行定义。
bool set_triangle_kernel_matrix_from_full_generic | ( | const T * | km, |
int32_t | rows, | ||
int32_t | cols | ||
) |
set kernel matrix (only elements from upper triangle) from squared matrix
km | kernel matrix |
rows | number of rows in matrix |
cols | number of cols in matrix |
在文件CustomKernel.h第236行定义。
bool set_triangle_kernel_matrix_from_triangle | ( | const float32_t * | km, |
int32_t | len | ||
) |
set kernel matrix (only elements from upper triangle) from elements of upper triangle (concat'd), including the main diagonal
small variant for floats32's, triangle needs to have less than 2**32 elements
km | kernel matrix |
len | denotes the size of the array and should match len=cols*(cols+1)/2 |
在文件CustomKernel.h第143行定义。
bool set_triangle_kernel_matrix_from_triangle | ( | const float64_t * | km, |
int32_t | len | ||
) |
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
km | kernel matrix |
len | denotes the size of the array and should match len=cols*(cols+1)/2 |
在文件CustomKernel.h第127行定义。
bool set_triangle_kernel_matrix_from_triangle_generic | ( | const T * | km, |
int64_t | len | ||
) |
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
km | kernel matrix |
len | denotes the size of the array and should match len=cols*(cols+1)/2 |
在文件CustomKernel.h第160行定义。
kernel matrix
在文件CustomKernel.h第388行定义。
int32_t num_cols [protected] |
number of columns
在文件CustomKernel.h第392行定义。
int32_t num_rows [protected] |
number of rows
在文件CustomKernel.h第390行定义。
bool upper_diagonal [protected] |
upper diagonal
在文件CustomKernel.h第394行定义。