|
SHOGUN
v1.1.0
|
The Combined kernel is used to combine a number of kernels into a single CombinedKernel object by linear combination.
It keeps pointers to the added sub-kernels
and for each sub-kernel - a kernel specific weight
.
It is especially useful to combine kernels working on different domains and to combine kernels looking at independent features and requires CCombinedFeatures to be used.
It is defined as:
Definition at line 46 of file CombinedKernel.h.

Static Public Member Functions | |
| static void * | compute_optimized_kernel_helper (void *p) |
| static void * | compute_kernel_helper (void *p) |
Protected Member Functions | |
| virtual float64_t | compute (int32_t x, int32_t y) |
| void | adjust_num_lhs_rhs_initialized (CKernel *k) |
Protected Member Functions inherited from CKernel | |
| void | set_property (EKernelProperty p) |
| void | unset_property (EKernelProperty p) |
| void | set_is_initialized (bool p_init) |
| int32_t | compute_row_start (int64_t offs, int32_t n, bool symmetric) |
| virtual void | load_serializable_post () throw (ShogunException) |
| virtual void | save_serializable_pre () throw (ShogunException) |
| virtual void | save_serializable_post () throw (ShogunException) |
| virtual void | register_params () |
Protected Member Functions inherited from CSGObject | |
| virtual void | load_serializable_pre () throw (ShogunException) |
Protected Attributes | |
| CList * | kernel_list |
| int32_t | sv_count |
| int32_t * | sv_idx |
| float64_t * | sv_weight |
| float64_t * | subkernel_weights_buffer |
| bool | append_subkernel_weights |
| bool | initialized |
Protected Attributes inherited from CKernel | |
| int32_t | cache_size |
| cache_size in MB | |
| KERNELCACHE_ELEM * | kernel_matrix |
| CFeatures * | lhs |
| feature vectors to occur on left hand side | |
| CFeatures * | rhs |
| feature vectors to occur on right hand side | |
| bool | lhs_equals_rhs |
| lhs | |
| int32_t | num_lhs |
| number of feature vectors on left hand side | |
| int32_t | num_rhs |
| number of feature vectors on right hand side | |
| float64_t | combined_kernel_weight |
| bool | optimization_initialized |
| EOptimizationType | opt_type |
| uint64_t | properties |
| CKernelNormalizer * | normalizer |
Additional Inherited Members | |
Public Attributes inherited from CSGObject | |
| SGIO * | io |
| Parallel * | parallel |
| Version * | version |
| Parameter * | m_parameters |
| Parameter * | m_model_selection_parameters |
Static Protected Member Functions inherited from CKernel | |
| template<class T > | |
| static void * | get_kernel_matrix_helper (void *p) |
| CCombinedKernel | ( | int32_t | size = 10, |
| bool | append_subkernel_weights = false |
||
| ) |
constructor
| size | cache size |
| append_subkernel_weights | if subkernel weights shall be appended |
Definition at line 45 of file CombinedKernel.cpp.
|
virtual |
Definition at line 56 of file CombinedKernel.cpp.
|
virtual |
add to normal vector
| idx | where to add |
| weight | what to add |
Reimplemented from CKernel.
Definition at line 579 of file CombinedKernel.cpp.
|
protected |
adjust the variables num_lhs, num_rhs and initialized based on the kernel to be appended/inserted
| k | kernel |
Definition at line 399 of file CombinedKernel.h.
| bool append_kernel | ( | CKernel * | k | ) |
append kernel
| k | kernel |
Definition at line 190 of file CombinedKernel.h.
|
virtual |
|
virtual |
|
protectedvirtual |
compute kernel function
| x | x |
| y | y |
Implements CKernel.
Definition at line 243 of file CombinedKernel.cpp.
|
virtual |
computes output for a batch of examples in an optimized fashion (favorable if kernel supports it, i.e. has KP_BATCHEVALUATION. to the outputvector target (of length num_vec elements) the output for the examples enumerated in vec_idx are added. therefore make sure that it is initialized with ZERO. the following num_suppvec, IDX, alphas arguments are the number of support vectors, their indices and weights
Reimplemented from CKernel.
Definition at line 336 of file CombinedKernel.cpp.
|
virtual |
compute by subkernel
| idx | index |
| subkernel_contrib | subkernel contribution |
Reimplemented from CKernel.
Definition at line 607 of file CombinedKernel.cpp.
|
static |
helper for compute kernel
| p | thread parameter |
Definition at line 383 of file CombinedKernel.cpp.
|
virtual |
compute optimized
| idx | index to compute |
Reimplemented from CKernel.
Definition at line 534 of file CombinedKernel.cpp.
|
static |
helper for compute optimized kernel
| p | thread parameter |
Definition at line 370 of file CombinedKernel.cpp.
| bool delete_kernel | ( | ) |
|
virtual |
delete optimization
Reimplemented from CKernel.
Definition at line 310 of file CombinedKernel.cpp.
| void emulate_compute_batch | ( | CKernel * | k, |
| int32_t | num_vec, | ||
| int32_t * | vec_idx, | ||
| float64_t * | target, | ||
| int32_t | num_suppvec, | ||
| int32_t * | IDX, | ||
| float64_t * | weights | ||
| ) |
emulates batch computation, via linadd optimization w^t x or even down to sum_i alpha_i K(x_i,x)
| k | kernel |
| num_vec | number of vectors |
| vec_idx | vector index |
| target | target |
| num_suppvec | number of support vectors |
| IDX | IDX |
| weights | weights |
Definition at line 405 of file CombinedKernel.cpp.
| bool get_append_subkernel_weights | ( | ) |
check if subkernel weights are appended
Definition at line 224 of file CombinedKernel.h.
|
virtual |
return feature class the kernel can deal with
Implements CKernel.
Definition at line 92 of file CombinedKernel.h.
|
virtual |
return feature type the kernel can deal with
Implements CKernel.
Definition at line 83 of file CombinedKernel.h.
| CKernel* get_first_kernel | ( | ) |
| CKernel* get_first_kernel | ( | CListElement *& | current | ) |
get first kernel
| current |
Definition at line 120 of file CombinedKernel.h.
| CKernel* get_kernel | ( | int32_t | idx | ) |
get kernel
| idx | index of kernel |
Definition at line 130 of file CombinedKernel.h.
|
virtual |
return what type of kernel we are
Implements CKernel.
Definition at line 74 of file CombinedKernel.h.
| CKernel* get_last_kernel | ( | ) |
|
virtual |
return the kernel's name
Implements CSGObject.
Definition at line 101 of file CombinedKernel.h.
| CKernel* get_next_kernel | ( | ) |
| CKernel* get_next_kernel | ( | CListElement *& | current | ) |
get next kernel multi-thread safe
| current |
Definition at line 164 of file CombinedKernel.h.
|
virtual |
get number of subkernels
Reimplemented from CKernel.
Definition at line 233 of file CombinedKernel.h.
|
virtual |
get subkernel weights
| num_weights | where number of weights is stored |
Reimplemented from CKernel.
Definition at line 646 of file CombinedKernel.cpp.
get subkernel weights (swig compatible)
Definition at line 688 of file CombinedKernel.cpp.
|
virtual |
test whether features have been assigned to lhs and rhs
Reimplemented from CKernel.
Definition at line 257 of file CombinedKernel.h.
initialize kernel
| lhs | features of left-hand side |
| rhs | features of right-hand side |
Reimplemented from CKernel.
Definition at line 67 of file CombinedKernel.cpp.
|
virtual |
initialize optimization
| count | count |
| IDX | index |
| weights | weights |
Reimplemented from CKernel.
Definition at line 259 of file CombinedKernel.cpp.
| bool insert_kernel | ( | CKernel * | k | ) |
insert kernel
| k | kernel |
Definition at line 174 of file CombinedKernel.h.
| CCombinedKernel* KernelToCombinedKernel | ( | shogun::CKernel * | n | ) |
casts kernel to combined kernel
| n | kernel to cast |
Definition at line 380 of file CombinedKernel.h.
| void list_kernels | ( | ) |
list kernels
Definition at line 225 of file CombinedKernel.cpp.
| bool precompute_subkernels | ( | ) |
precompute all sub-kernels
Definition at line 746 of file CombinedKernel.cpp.
|
virtual |
remove lhs from kernel
Reimplemented from CKernel.
Definition at line 147 of file CombinedKernel.cpp.
|
virtual |
remove lhs and rhs from kernel
Reimplemented from CKernel.
Definition at line 184 of file CombinedKernel.cpp.
|
virtual |
remove rhs from kernel
Reimplemented from CKernel.
Definition at line 167 of file CombinedKernel.cpp.
|
virtual |
set optimization type
| t | optimization type |
Reimplemented from CKernel.
Definition at line 731 of file CombinedKernel.cpp.
set subkernel weights
| weights | new subkernel weights |
Reimplemented from CKernel.
Definition at line 696 of file CombinedKernel.cpp.
|
protected |
if subkernel weights are appended
Definition at line 449 of file CombinedKernel.h.
|
protected |
whether kernel is ready to be used
Definition at line 451 of file CombinedKernel.h.
|
protected |
list of kernels
Definition at line 439 of file CombinedKernel.h.
|
protected |
subkernel weights buffers
Definition at line 447 of file CombinedKernel.h.
|
protected |
support vector count
Definition at line 441 of file CombinedKernel.h.
|
protected |
support vector index
Definition at line 443 of file CombinedKernel.h.
|
protected |
support vector weights
Definition at line 445 of file CombinedKernel.h.