Public Member Functions | Protected Member Functions | Protected Attributes

CChi2Kernel Class Reference


Detailed Description

The Chi2 kernel operating on realvalued vectors computes the chi-squared distance between sets of histograms.

It is a very useful distance in image recognition (used to detect objects).

It is defined as

\[ k({\bf x},({\bf x'})= e^{-\frac{1}{width} \sum_{i=0}^{l}\frac{(x_i-x'_i)^2}{(x_i+x'_i)}} \]

Definition at line 32 of file Chi2Kernel.h.

Inheritance diagram for CChi2Kernel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CChi2Kernel (void)
 CChi2Kernel (int32_t size, float64_t width)
 CChi2Kernel (CSimpleFeatures< float64_t > *l, CSimpleFeatures< float64_t > *r, float64_t width, int32_t size)
virtual ~CChi2Kernel ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual EKernelType get_kernel_type ()
virtual EFeatureClass get_feature_class ()
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

Constructor & Destructor Documentation

CChi2Kernel ( void   ) 

default constructor

Definition at line 25 of file Chi2Kernel.cpp.

CChi2Kernel ( int32_t  size,
float64_t  width 
)

constructor

Parameters:
size cache size
width width

Definition at line 31 of file Chi2Kernel.cpp.

CChi2Kernel ( CSimpleFeatures< float64_t > *  l,
CSimpleFeatures< float64_t > *  r,
float64_t  width,
int32_t  size 
)

constructor

Parameters:
l features of left-hand side
r features of right-hand side
width width
size cache size

Definition at line 37 of file Chi2Kernel.cpp.

~CChi2Kernel (  )  [virtual]

Definition at line 45 of file Chi2Kernel.cpp.


Member Function Documentation

float64_t 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

Parameters:
idx_a index a
idx_b index b
Returns:
computed kernel function at indices a,b

Reimplemented from CDotKernel.

Definition at line 57 of file Chi2Kernel.cpp.

virtual EFeatureClass get_feature_class (  )  [virtual]

return feature class the kernel can deal with

Returns:
feature class SIMPLE

Reimplemented from CDotKernel.

Definition at line 77 of file Chi2Kernel.h.

virtual EFeatureType get_feature_type (  )  [virtual]

return feature type the kernel can deal with

Returns:
float64_t feature type

Reimplemented from CDotKernel.

Definition at line 83 of file Chi2Kernel.h.

virtual EKernelType get_kernel_type (  )  [virtual]

return what type of kernel we are

Returns:
kernel type CHI2

Implements CDotKernel.

Definition at line 71 of file Chi2Kernel.h.

virtual const char* get_name ( void   )  const [virtual]

return the kernel's name

Returns:
name Chi2

Reimplemented from CDotKernel.

Definition at line 89 of file Chi2Kernel.h.

bool init ( CFeatures l,
CFeatures r 
) [virtual]

initialize kernel

Parameters:
l features of left-hand side
r features of right-hand side
Returns:
if initializing was successful

Reimplemented from CDotKernel.

Definition at line 50 of file Chi2Kernel.cpp.


Member Data Documentation

float64_t width [protected]

width

Definition at line 104 of file Chi2Kernel.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation