GClasses

GClasses::GLNormDistance Class Reference

Interpolates between manhattan distance (norm=1), Euclidean distance (norm=2), and Chebyshev distance (norm=infinity). For nominal attributes, Hamming distance is used. More...

#include <GDistance.h>

Inheritance diagram for GClasses::GLNormDistance:
GClasses::GDistanceMetric

List of all members.

Public Member Functions

 GLNormDistance (double norm)
 GLNormDistance (GDomNode *pNode)
virtual GDomNodeserialize (GDom *pDoc)
 See the comment for GDistanceMetric::serialize.
virtual void init (sp_relation &pRelation)
 See the comment for GDistanceMetric::init.
virtual double squaredDistance (const double *pA, const double *pB) const
 Returns the distance (using the norm passed to the constructor) between pA and pB.
void setDiffWithUnknown (double d)
 Specify the difference to use when one or more of the values is unknown. (If your data contains unknown values, you may want to normalize the known values to fall within some pre-determined range, so that it will be possible to select a reasonable value for this purpose.)

Protected Attributes

double m_norm
double m_diffWithUnknown

Detailed Description

Interpolates between manhattan distance (norm=1), Euclidean distance (norm=2), and Chebyshev distance (norm=infinity). For nominal attributes, Hamming distance is used.


Constructor & Destructor Documentation

GClasses::GLNormDistance::GLNormDistance ( double  norm)
GClasses::GLNormDistance::GLNormDistance ( GDomNode pNode)

Member Function Documentation

virtual void GClasses::GLNormDistance::init ( sp_relation pRelation) [virtual]

See the comment for GDistanceMetric::init.

Implements GClasses::GDistanceMetric.

virtual GDomNode* GClasses::GLNormDistance::serialize ( GDom pDoc) [virtual]

See the comment for GDistanceMetric::serialize.

Implements GClasses::GDistanceMetric.

void GClasses::GLNormDistance::setDiffWithUnknown ( double  d) [inline]

Specify the difference to use when one or more of the values is unknown. (If your data contains unknown values, you may want to normalize the known values to fall within some pre-determined range, so that it will be possible to select a reasonable value for this purpose.)

virtual double GClasses::GLNormDistance::squaredDistance ( const double *  pA,
const double *  pB 
) const [virtual]

Returns the distance (using the norm passed to the constructor) between pA and pB.

Implements GClasses::GDistanceMetric.


Member Data Documentation