Public Member Functions | Protected Member Functions

CTanimotoDistance Class Reference


Detailed Description

class Tanimoto coefficient

The Tanimoto distance/coefficient (extended Jaccard coefficient) is obtained by extending the cosine similarity.

\[\displaystyle d(\bf{x},\bf{x'}) = \frac{\sum_{i=1}^{n}x_{i}x'_{i}}{ \sum_{i=1}^{n}x_{i}x_{i}x'_{i}x'_{i}-x_{i}x'_{i}} /quad x,x' /in R^{n} \]

See also:
Wikipedia: Tanimoto coefficient
CCosineDistance

Definition at line 35 of file TanimotoDistance.h.

Inheritance diagram for CTanimotoDistance:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CTanimotoDistance ()
 CTanimotoDistance (CSimpleFeatures< float64_t > *l, CSimpleFeatures< float64_t > *r)
virtual ~CTanimotoDistance ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual void cleanup ()
virtual EDistanceType get_distance_type ()
virtual const char * get_name () const

Protected Member Functions

virtual float64_t compute (int32_t idx_a, int32_t idx_b)

Constructor & Destructor Documentation

default constructor

Definition at line 20 of file TanimotoDistance.cpp.

constructor

Parameters:
l features of left-hand side
r features of right-hand side

Definition at line 25 of file TanimotoDistance.cpp.

~CTanimotoDistance (  )  [virtual]

Definition at line 31 of file TanimotoDistance.cpp.


Member Function Documentation

void cleanup (  )  [virtual]

cleanup distance

Implements CSimpleDistance< float64_t >.

Definition at line 43 of file TanimotoDistance.cpp.

float64_t compute ( int32_t  idx_a,
int32_t  idx_b 
) [protected, virtual]

compute distance for features a and b idx_{a,b} denote the index of the feature vectors in the corresponding feature object

Implements CDistance.

Definition at line 47 of file TanimotoDistance.cpp.

virtual EDistanceType get_distance_type (  )  [virtual]

get distance type we are

Returns:
distance type TANIMOTO

Implements CSimpleDistance< float64_t >.

Definition at line 64 of file TanimotoDistance.h.

virtual const char* get_name (  )  const [virtual]

get name of the distance

Returns:
name Tanimoto coefficient/distance

Reimplemented from CSimpleDistance< float64_t >.

Definition at line 70 of file TanimotoDistance.h.

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

init distance

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

Reimplemented from CSimpleDistance< float64_t >.

Definition at line 36 of file TanimotoDistance.cpp.


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