|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--coreComponents.DistanceMetric | +--coreComponents.EuclideanDistanceMetric
Implementing Euclidean distance (or similarity) function. One object defines not one distance but the data model in which the distances between objects of that data model can be computed. Attention: For efficiency reasons the use of consistency checks (like are the data models of the two instances exactly the same), is low. This has been updated for my own personal (davidl) needs!
Field Summary | |
Instances |
m_Model
|
Constructor Summary | |
EuclideanDistanceMetric()
Constructs an Euclidean Distance object. |
|
EuclideanDistanceMetric(Instances data)
Constructs an Euclidean Distance object. |
Method Summary | |
void |
checkInstances()
Checks the instances. |
boolean |
checkInstances(Instances instances)
Check if the instances are valid for the distance metric. |
double |
distance(Instance first,
Instance second)
Calculates the distance (or similarity) between two instances. |
static void |
main(java.lang.String[] args)
Main method for testing this class. |
void |
reset(Instances instances)
This function is useful if we need to reinitialise the distance metric without using the constructor |
java.lang.String |
toString()
Documents the content of an EuclideanDistance object in a string. |
void |
updateRanges(Instance inst1)
Update the ranges of the distance metric with a new training instance. |
Methods inherited from class coreComponents.DistanceMetric |
forName |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public Instances m_Model
Constructor Detail |
public EuclideanDistanceMetric()
public EuclideanDistanceMetric(Instances data)
data
- the instances the distance function should work onMethod Detail |
public boolean checkInstances(Instances instances)
checkInstances
in class DistanceMetric
instances
- the training instances to be checked
public void reset(Instances instances)
reset
in class DistanceMetric
public void updateRanges(Instance inst1)
updateRanges
in class DistanceMetric
inst1
- the instance to update with
public double distance(Instance first, Instance second)
distance
in class DistanceMetric
first
- the first instancesecond
- the second instance
public void checkInstances() throws java.lang.Exception
java.lang.Exception
public java.lang.String toString()
toString
in class DistanceMetric
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London