Pyramid Kernel over Chi2 matched histograms.
The Pyramid Chi2 Kernel often used in image classification with sum inside the exponential. TODO: add adaptive width computation via median
Definition at line 30 of file PyramidChi2.h.
Public Member Functions | |
CPyramidChi2 (int32_t size, int32_t num_cells2, float64_t *weights_foreach_cell2, int32_t width_computation_type2, float64_t width2) | |
CPyramidChi2 (CSimpleFeatures< float64_t > *l, CSimpleFeatures< float64_t > *r, int32_t size, int32_t num_cells2, float64_t *weights_foreach_cell2, int32_t width_computation_type2, float64_t width2) | |
virtual bool | init (CFeatures *l, CFeatures *r) |
virtual | ~CPyramidChi2 () |
virtual void | cleanup () |
virtual EKernelType | get_kernel_type () |
virtual const char * | get_name () const |
Protected Member Functions | |
CPyramidChi2 () | |
virtual float64_t | compute (int32_t idx_a, int32_t idx_b) |
Protected Attributes | |
int32_t | num_cells |
float64_t * | weights |
int32_t | width_computation_type |
float64_t | width |
int32_t | num_randfeats_forwidthcomputation |
CPyramidChi2 | ( | int32_t | size, | |
int32_t | num_cells2, | |||
float64_t * | weights_foreach_cell2, | |||
int32_t | width_computation_type2, | |||
float64_t | width2 | |||
) |
constructor
size | cache size in MB | |
num_cells2 | - the number of pyramid cells | |
weights_foreach_cell2 | the vector of weights for each cell with which the Chi2 distance gets weighted | |
width_computation_type2 | - 0 use the following parameter as fixed width, 1- use mean of inner distances, 2 - use median of inner distances in cases 1 and 2 the value of parameter width is important!!! | |
width2 | - in case of width_computation_type ==0 it is the width, in case of width_computation_type > 0 its value determines the how many random features are used for determining the width in case of width_computation_type > 0 set width2 <=1 to use all LEFT HAND SIDE features for width estimation |
Definition at line 31 of file PyramidChi2.cpp.
CPyramidChi2 | ( | CSimpleFeatures< float64_t > * | l, | |
CSimpleFeatures< float64_t > * | r, | |||
int32_t | size, | |||
int32_t | num_cells2, | |||
float64_t * | weights_foreach_cell2, | |||
int32_t | width_computation_type2, | |||
float64_t | width2 | |||
) |
constructor
l | features lhs convention: concatenated features along all cells, i.e. [feature for cell1, feature for cell2, ... feature for last cell] , the dimensionality of the base feature is equal to dividing the total feature length by the number ofcells | |
r | features rhs the same convention as for param l applies here | |
size | size | |
num_cells2 | - the number of pyramid cells | |
weights_foreach_cell2 | the vector of weights for each cell with which the Chi2 distance gets weighted | |
width_computation_type | - 0 use the following parameter as fixed width, 1- use mean of inner distances in case 1 the value of parameter width is important!!! | |
width2 | - in case of width_computation_type ==0 it is the width, in case of width_computation_type > 0 its value determines the how many random features are used for determining the width in case of width_computation_type > 0 set width2 <=1 to use all LEFT HAND SIDE features for width estimation |
Definition at line 83 of file PyramidChi2.cpp.
~CPyramidChi2 | ( | ) | [virtual] |
Definition at line 115 of file PyramidChi2.cpp.
CPyramidChi2 | ( | ) | [protected] |
sets standard weights performs a weak check, does not test for correct feature length default constructor protected to avoid its usage
Definition at line 21 of file PyramidChi2.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 | index of feature vector a | |
idx_b | index of feature vector b |
Implements CKernel.
Definition at line 122 of file PyramidChi2.cpp.
virtual EKernelType get_kernel_type | ( | ) | [virtual] |
return what type of kernel we are Linear,Polynomial, Gaussian,...
Implements CKernel.
Definition at line 92 of file PyramidChi2.h.
virtual const char* get_name | ( | ) | const [virtual] |
init
l | features lhs | |
r | reatures rhs |
Reimplemented from CSimpleKernel< float64_t >.
Definition at line 77 of file PyramidChi2.cpp.
int32_t num_cells [protected] |
number of pyramidcells across all pyramidlevel
Definition at line 121 of file PyramidChi2.h.
int32_t num_randfeats_forwidthcomputation [protected] |
in case of adaptive width computation: how many features to use
Definition at line 131 of file PyramidChi2.h.
vector of weights for each pyramid cell
Definition at line 124 of file PyramidChi2.h.
width
Definition at line 129 of file PyramidChi2.h.
int32_t width_computation_type [protected] |
width_computation_type
Definition at line 127 of file PyramidChi2.h.