GClasses

GClasses::GRowDistance Class Reference

This uses a combination of Euclidean distance for continuous attributes, and Hamming distance for nominal attributes. In particular, for each attribute, it calculates pA[i]-pB[i], squares it and takes the square root of that sum. For nominal attributes pA[i]-pB[i] is 0 if they are the same and 1 if they are different. More...

#include <GDistance.h>

Inheritance diagram for GClasses::GRowDistance:
GClasses::GDistanceMetric

List of all members.

Public Member Functions

 GRowDistance ()
 GRowDistance (GDomNode *pNode)
virtual ~GRowDistance ()
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 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_diffWithUnknown

Detailed Description

This uses a combination of Euclidean distance for continuous attributes, and Hamming distance for nominal attributes. In particular, for each attribute, it calculates pA[i]-pB[i], squares it and takes the square root of that sum. For nominal attributes pA[i]-pB[i] is 0 if they are the same and 1 if they are different.


Constructor & Destructor Documentation

GClasses::GRowDistance::GRowDistance ( )
GClasses::GRowDistance::GRowDistance ( GDomNode pNode)
virtual GClasses::GRowDistance::~GRowDistance ( ) [inline, virtual]

Member Function Documentation

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

See the comment for GDistanceMetric::init.

Implements GClasses::GDistanceMetric.

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

See the comment for GDistanceMetric::serialize.

Implements GClasses::GDistanceMetric.

void GClasses::GRowDistance::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::GRowDistance::squaredDistance ( const double *  pA,
const double *  pB 
) const [virtual]

Returns the distance between pA and pB.

Implements GClasses::GDistanceMetric.


Member Data Documentation