|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--coreComponents.DistanceMetric | +--classifiers.usm.distance.USMDistanceFunction
Abstract class to implement Vitanyi's wonderful Universal Similarity Metric (USM) distance function.
Constructor Summary | |
USMDistanceFunction(Instances data)
Constructs a distance function object. |
Method Summary | |
abstract USMComplexityCache |
calculateComplexityAndComplexityStarOf(Instance i,
Attribute a)
Calculates the first K(x) and second order K(x*) complexities of an object x |
abstract double |
calculateConcatenatedComplexityOf(Instance x,
Instance y,
USMComplexityCache usmcc)
Calculates the first K(xy*) complexity of an object x with a compressed object y* |
double |
calculateUSM(double kX,
double kXStar,
double kY,
double kYStar,
double kXY,
double kYX)
Function to compute the USM distance from the respective complexity estmiates from the instances x and y. |
abstract boolean |
checkInstance(Instance i)
Function to check that an individual instance is of the correct format. |
abstract boolean |
checkInstances(Instances is)
Function to check that the data instances are in the correct format. |
void |
definePrefix(java.lang.String p)
This function defines the prefix used for this type. |
double |
distance(Instance x,
Instance y)
Calculates the distance (or similarity) between two instances. |
void |
findAttributesWithPrefix()
The function |
int |
findInstanceInCache(Instance inst,
Attribute a)
Finds if complexities have been cached for an instance and if so returns the index in the cache vector. |
USMComplexityCache |
returnInstanceCache(int index)
Simple function that returns the instance cache at a specified index |
java.lang.String |
toString()
Converts a DistanceFunction object to a string |
void |
updateInstanceCache(USMComplexityCache usmcc)
Updates the instance complexity cache |
Methods inherited from class coreComponents.DistanceMetric |
forName, reset, updateRanges |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public USMDistanceFunction(Instances data)
data
- the instances the distance function should work on.Method Detail |
public void definePrefix(java.lang.String p)
p
- the prefix stringpublic void findAttributesWithPrefix()
public abstract boolean checkInstances(Instances is)
checkInstances
in class DistanceMetric
is
- the instances to be checked
public abstract boolean checkInstance(Instance i)
i
- the instance to be checked
public int findInstanceInCache(Instance inst, Attribute a)
public USMComplexityCache returnInstanceCache(int index)
public double calculateUSM(double kX, double kXStar, double kY, double kYStar, double kXY, double kYX)
kX
- the Kolmogorov complexity of the instance object xkXStar
- the Kolmogorov complexity of the compressed instance object x (aka x* or xStar)kY
- the Kolmogorov complexity of the instance object xkYStar
- the Kolmogorov complexity of the compressed instance object x (aka x* or xStar)kXY
- the Kolmogorov complexity of the string x concatenated with y (aka xy), this does not include a comma!kYX
- the Kolmogorov complexity of the string y concatenated with x (aka yx), this does not include a comma!public double distance(Instance x, Instance y)
distance
in class DistanceMetric
x
- the first instancey
- the second instance
public void updateInstanceCache(USMComplexityCache usmcc)
usmcc
- the complexity cache for an examplepublic abstract USMComplexityCache calculateComplexityAndComplexityStarOf(Instance i, Attribute a)
i
- the instance to calculate the complexities for
public abstract double calculateConcatenatedComplexityOf(Instance x, Instance y, USMComplexityCache usmcc)
x
- the instance to usey
- the instance to use the compression of
public java.lang.String toString()
toString
in class DistanceMetric
|
|||||||||
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