GClasses
|
The base class for similarity metrics that operate on sparse vectors. More...
#include <GDistance.h>
Public Member Functions | |
GSparseSimilarity () | |
virtual | ~GSparseSimilarity () |
void | setRegularizer (double d) |
Set a regularizing term to add to the denominator. | |
virtual GDomNode * | serialize (GDom *pDoc)=0 |
Marshal this object into a DOM, which can then be converted to a variety of serial formats. | |
virtual double | similarity (const std::map< size_t, double > &a, const std::map< size_t, double > &b)=0 |
Computes the similarity between two sparse vectors. | |
virtual double | similarity (const std::map< size_t, double > &a, const double *pB)=0 |
Computes the similarity between a sparse and a dense vector. | |
Static Public Member Functions | |
static GSparseSimilarity * | deserialize (GDomNode *pNode) |
Load from a DOM. | |
Protected Member Functions | |
GDomNode * | baseDomNode (GDom *pDoc, const char *szClassName) |
A helper method used internally. | |
Protected Attributes | |
double | m_regularizer |
The base class for similarity metrics that operate on sparse vectors.
GClasses::GSparseSimilarity::GSparseSimilarity | ( | ) | [inline] |
virtual GClasses::GSparseSimilarity::~GSparseSimilarity | ( | ) | [inline, virtual] |
GDomNode* GClasses::GSparseSimilarity::baseDomNode | ( | GDom * | pDoc, |
const char * | szClassName | ||
) | [protected] |
A helper method used internally.
static GSparseSimilarity* GClasses::GSparseSimilarity::deserialize | ( | GDomNode * | pNode | ) | [static] |
Load from a DOM.
Marshal this object into a DOM, which can then be converted to a variety of serial formats.
Implemented in GClasses::GCosineSimilarity, and GClasses::GPearsonCorrelation.
void GClasses::GSparseSimilarity::setRegularizer | ( | double | d | ) | [inline] |
Set a regularizing term to add to the denominator.
virtual double GClasses::GSparseSimilarity::similarity | ( | const std::map< size_t, double > & | a, |
const std::map< size_t, double > & | b | ||
) | [pure virtual] |
Computes the similarity between two sparse vectors.
Implemented in GClasses::GCosineSimilarity, and GClasses::GPearsonCorrelation.
virtual double GClasses::GSparseSimilarity::similarity | ( | const std::map< size_t, double > & | a, |
const double * | pB | ||
) | [pure virtual] |
Computes the similarity between a sparse and a dense vector.
Implemented in GClasses::GCosineSimilarity, and GClasses::GPearsonCorrelation.
double GClasses::GSparseSimilarity::m_regularizer [protected] |