GClasses
GClasses::GSparseSimilarity Class Referenceabstract

Detailed Description

The base class for similarity metrics that operate on sparse vectors.

#include <GDistance.h>

Inheritance diagram for GClasses::GSparseSimilarity:
GClasses::GCosineSimilarity GClasses::GEuclidSimilarity GClasses::GPearsonCorrelation

Public Member Functions

 GSparseSimilarity ()
 
virtual ~GSparseSimilarity ()
 
virtual GDomNodeserialize (GDom *pDoc) const =0
 Marshal this object into a DOM, which can then be converted to a variety of serial formats. More...
 
void setRegularizer (double d)
 Set a regularizing term to add to the denominator. More...
 
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. More...
 
virtual double similarity (const std::map< size_t, double > &a, const GVec &b)=0
 Computes the similarity between a sparse and a dense vector. More...
 
virtual double similarity (const GVec &a, const GVec &b)=0
 Computes the similarity between two dense vectors. More...
 

Static Public Member Functions

static GSparseSimilaritydeserialize (GDomNode *pNode)
 Load from a DOM. More...
 

Protected Member Functions

GDomNodebaseDomNode (GDom *pDoc, const char *szClassName) const
 A helper method used internally. More...
 

Protected Attributes

double m_regularizer
 

Constructor & Destructor Documentation

GClasses::GSparseSimilarity::GSparseSimilarity ( )
inline
virtual GClasses::GSparseSimilarity::~GSparseSimilarity ( )
inlinevirtual

Member Function Documentation

GDomNode* GClasses::GSparseSimilarity::baseDomNode ( GDom pDoc,
const char *  szClassName 
) const
protected

A helper method used internally.

static GSparseSimilarity* GClasses::GSparseSimilarity::deserialize ( GDomNode pNode)
static

Load from a DOM.

virtual GDomNode* GClasses::GSparseSimilarity::serialize ( GDom pDoc) const
pure virtual

Marshal this object into a DOM, which can then be converted to a variety of serial formats.

Implemented in GClasses::GEuclidSimilarity, GClasses::GPearsonCorrelation, and GClasses::GCosineSimilarity.

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::GEuclidSimilarity, GClasses::GPearsonCorrelation, and GClasses::GCosineSimilarity.

virtual double GClasses::GSparseSimilarity::similarity ( const std::map< size_t, double > &  a,
const GVec b 
)
pure virtual

Computes the similarity between a sparse and a dense vector.

Implemented in GClasses::GEuclidSimilarity, GClasses::GPearsonCorrelation, and GClasses::GCosineSimilarity.

virtual double GClasses::GSparseSimilarity::similarity ( const GVec a,
const GVec b 
)
pure virtual

Computes the similarity between two dense vectors.

Implemented in GClasses::GEuclidSimilarity, GClasses::GPearsonCorrelation, and GClasses::GCosineSimilarity.

Member Data Documentation

double GClasses::GSparseSimilarity::m_regularizer
protected