Public Member Functions | |
CCosineDistance () | |
CCosineDistance (CRealFeatures *l, CRealFeatures *r) | |
virtual | ~CCosineDistance () |
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 () |
Protected Member Functions | |
virtual float64_t | compute (int32_t idx_a, int32_t idx_b) |
The Cosine distance is obtained by using the Cosine similarity (Orchini similarity, angular similarity, normalized dot product), which measures similarity between two vectors by finding their angle. An extension to the Cosine similarity yields the Tanimoto coefficient.
Definition at line 34 of file CosineDistance.h.
CCosineDistance::CCosineDistance | ( | ) |
default constructor
Definition at line 18 of file CosineDistance.cpp.
CCosineDistance::CCosineDistance | ( | CRealFeatures * | l, | |
CRealFeatures * | r | |||
) |
constructor
l | features of left-hand side | |
r | features of right-hand side |
Definition at line 23 of file CosineDistance.cpp.
CCosineDistance::~CCosineDistance | ( | ) | [virtual] |
Definition at line 29 of file CosineDistance.cpp.
void CCosineDistance::cleanup | ( | ) | [virtual] |
float64_t CCosineDistance::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 CosineDistance.cpp.
virtual EDistanceType CCosineDistance::get_distance_type | ( | ) | [virtual] |
get distance type we are
Implements CDistance.
Definition at line 77 of file CosineDistance.h.
virtual const char* CCosineDistance::get_name | ( | ) | [virtual] |
get name of the distance
Implements CDistance.
Definition at line 83 of file CosineDistance.h.
init distance
l | features of left-hand side | |
r | features of right-hand side |
Reimplemented from CSimpleDistance< float64_t >.
Definition at line 34 of file CosineDistance.cpp.
bool CCosineDistance::load_init | ( | FILE * | src | ) | [virtual] |
load init data from file
src | file to load from |
Implements CDistance.
Definition at line 45 of file CosineDistance.cpp.
bool CCosineDistance::save_init | ( | FILE * | dest | ) | [virtual] |
save init data to file
dest | file to save to |
Implements CDistance.
Definition at line 50 of file CosineDistance.cpp.