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 33 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 bool load_init (FILE *src)
virtual bool save_init (FILE *dest)
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

CTanimotoDistance::CTanimotoDistance (  ) 

default constructor

Definition at line 18 of file TanimotoDistance.cpp.

CTanimotoDistance::CTanimotoDistance ( CSimpleFeatures< float64_t > *  l,
CSimpleFeatures< float64_t > *  r 
)

constructor

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

Definition at line 23 of file TanimotoDistance.cpp.

CTanimotoDistance::~CTanimotoDistance (  )  [virtual]

Definition at line 29 of file TanimotoDistance.cpp.


Member Function Documentation

void CTanimotoDistance::cleanup (  )  [virtual]

cleanup distance

Implements CDistance.

Definition at line 41 of file TanimotoDistance.cpp.

float64_t CTanimotoDistance::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 55 of file TanimotoDistance.cpp.

virtual EDistanceType CTanimotoDistance::get_distance_type (  )  [virtual]

get distance type we are

Returns:
distance type TANIMOTO

Implements CDistance.

Definition at line 76 of file TanimotoDistance.h.

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

get name of the distance

Returns:
name Tanimoto coefficient/distance

Implements CSGObject.

Definition at line 82 of file TanimotoDistance.h.

bool CTanimotoDistance::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 34 of file TanimotoDistance.cpp.

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

load init data from file

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

Implements CDistance.

Definition at line 45 of file TanimotoDistance.cpp.

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

save init data to file

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

Implements CDistance.

Definition at line 50 of file TanimotoDistance.cpp.


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

SHOGUN Machine Learning Toolbox - Documentation