|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.DistanceFunction
Abstract class to implement a distance function.
Field Summary | |
protected Instances |
m_Model
the data model |
double[][] |
m_Ranges
the range of the attributes |
protected static int |
R_MAX
|
protected static int |
R_MIN
Index in ranges for MIN and MAX and WIDTH |
protected static int |
R_WIDTH
|
Constructor Summary | |
DistanceFunction()
Constructs a distance function object. |
|
DistanceFunction(Instances data)
Constructs a distance function object. |
|
DistanceFunction(Instances data,
double[][] ranges)
Constructs a distance function object. |
Method Summary | |
abstract void |
checkInstances()
Checks the instances if compatibel with the distance function. |
int |
closestPoint(Instance instance,
Instances allPoints,
int[] pointList)
Returns the index of the closest point to the current instance. |
abstract double |
distance(Instance first,
Instance second)
Calculates the distance (or similarity) between two instances. |
abstract double |
getMiddle(double[] ranges)
Returns value in the middle of the two parameter values. |
java.lang.String |
toString()
Converts a DistanceFunction object to a string |
void |
updateRanges(Instance instance)
Update the ranges if a new instance comes. |
abstract boolean |
valueIsSmallerEqual(Instance instance,
int dim,
double value)
Returns true if the value of the given dimension is smaller or equal the value to be compared with. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Instances m_Model
public double[][] m_Ranges
protected static final int R_MIN
protected static final int R_MAX
protected static final int R_WIDTH
Constructor Detail |
public DistanceFunction()
public DistanceFunction(Instances data)
data
- the instances the distance function should work on.public DistanceFunction(Instances data, double[][] ranges)
data
- the instances the distance function should work on.ranges
- the min and max values of the attribute valuesMethod Detail |
public abstract double distance(Instance first, Instance second) throws java.lang.Exception
first
- the first instancesecond
- the second instance
java.lang.Exception
public abstract double getMiddle(double[] ranges)
public abstract void checkInstances() throws java.lang.Exception
java.lang.Exception
public abstract boolean valueIsSmallerEqual(Instance instance, int dim, double value)
instance
- the instance where the value should be taken ofdim
- the dimension of the value
public int closestPoint(Instance instance, Instances allPoints, int[] pointList) throws java.lang.Exception
instance
- the instance to assign a cluster to
java.lang.Exception
public void updateRanges(Instance instance)
instance
- the new instancepublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |