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 30 of file Chi2Kernel.h.

Inheritance diagram for CChi2Kernel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 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 bool load_init (FILE *src)
virtual bool save_init (FILE *dest)
virtual EKernelType get_kernel_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::CChi2Kernel ( int32_t  size,
float64_t  width 
)

constructor

Parameters:
size cache size
width width

Definition at line 17 of file Chi2Kernel.cpp.

CChi2Kernel::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 22 of file Chi2Kernel.cpp.

CChi2Kernel::~CChi2Kernel (  )  [virtual]

Definition at line 29 of file Chi2Kernel.cpp.


Member Function Documentation

float64_t CChi2Kernel::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

Implements CKernel.

Definition at line 51 of file Chi2Kernel.cpp.

virtual EKernelType CChi2Kernel::get_kernel_type (  )  [virtual]

return what type of kernel we are

Returns:
kernel type CHI2

Implements CKernel.

Definition at line 78 of file Chi2Kernel.h.

virtual const char* CChi2Kernel::get_name (  )  const [virtual]

return the kernel's name

Returns:
name Chi2

Implements CSGObject.

Definition at line 84 of file Chi2Kernel.h.

bool CChi2Kernel::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 CSimpleKernel< float64_t >.

Definition at line 34 of file Chi2Kernel.cpp.

bool CChi2Kernel::load_init ( FILE *  src  )  [virtual]

load kernel init_data

Parameters:
src file to load from
Returns:
if loading was successful

Implements CKernel.

Definition at line 41 of file Chi2Kernel.cpp.

bool CChi2Kernel::save_init ( FILE *  dest  )  [virtual]

save kernel init_data

Parameters:
dest file to save to
Returns:
if saving was successful

Implements CKernel.

Definition at line 46 of file Chi2Kernel.cpp.


Member Data Documentation

width

Definition at line 99 of file Chi2Kernel.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation