|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDatabaseDistanceFunction<O,D> de.lmu.ifi.dbs.elki.distance.distancefunction.MinKDistance<O,D>
O
- Database object typeD
- Distance typepublic class MinKDistance<O,D extends Distance<D>>
A distance that is at least the distance to the kth nearest neighbor. This is essentially the "reachability distance" of LOF, but with arguments reversed! Reachability of B from A, i.e.
reachability-distance(A,B) = max( k-distance(A), distance(A,B) )Where k-distance(A) is the distance to the k nearest neighbor of A, and distance is the actual distance of A and B. This distance is NOT symmetric. You need to pay attention to the order of arguments!
Nested Class Summary | |
---|---|
class |
MinKDistance.Instance<T extends O>
Instance for an actual database. |
static class |
MinKDistance.Parameterizer<O,D extends Distance<D>>
Parameterization class. |
Field Summary | |
---|---|
static OptionID |
DISTANCE_FUNCTION_ID
OptionID for the base distance used to compute reachability |
private int |
k
The value of k |
static OptionID |
K_ID
OptionID for the "k" parameter. |
static OptionID |
KNNQUERY_ID
OptionID for the KNN query class to use (preprocessor, approximation, ...) |
(package private) static boolean |
objectIsInKNN
Include object itself in kNN neighborhood. |
protected DistanceFunction<? super O,D> |
parentDistance
The distance function to determine the exact distance. |
Constructor Summary | |
---|---|
MinKDistance(DistanceFunction<? super O,D> parentDistance,
int k)
Full constructor. |
Method Summary | ||
---|---|---|
protected D |
computeReachdist(List<DistanceResultPair<D>> neighborhood,
D truedist)
Actually compute the distance, whichever way we obtained the neighborhood above. |
|
boolean |
equals(Object obj)
|
|
D |
getDistanceFactory()
Method to get the distance functions factory. |
|
TypeInformation |
getInputTypeRestriction()
Get the input data type of the function. |
|
|
instantiate(Relation<T> relation)
Instantiate with a database to get the actual distance query. |
|
boolean |
isMetric()
Is this distance function metric (in particular, does it satisfy the triangle equation?) |
|
boolean |
isSymmetric()
Is this function symmetric? |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final OptionID DISTANCE_FUNCTION_ID
public static final OptionID KNNQUERY_ID
public static final OptionID K_ID
protected DistanceFunction<? super O,D extends Distance<D>> parentDistance
private int k
static boolean objectIsInKNN
Constructor Detail |
---|
public MinKDistance(DistanceFunction<? super O,D> parentDistance, int k)
MinKDistance.Parameterizer
for factory.
parentDistance
- distance function to usek
- K parameterMethod Detail |
---|
public <T extends O> DistanceQuery<T,D> instantiate(Relation<T> relation)
DistanceFunction
relation
- The representation to use
protected D computeReachdist(List<DistanceResultPair<D>> neighborhood, D truedist)
neighborhood
- Neighborhoodtruedist
- True distance
public boolean isMetric()
DistanceFunction
isMetric
in interface DistanceFunction<O,D extends Distance<D>>
isMetric
in class AbstractDatabaseDistanceFunction<O,D extends Distance<D>>
true
when metric.public boolean isSymmetric()
DistanceFunction
isSymmetric
in interface DistanceFunction<O,D extends Distance<D>>
isSymmetric
in class AbstractDatabaseDistanceFunction<O,D extends Distance<D>>
true
when symmetricpublic D getDistanceFactory()
DistanceFunction
getDistanceFactory
in interface DistanceFunction<O,D extends Distance<D>>
getDistanceFactory
in class AbstractDatabaseDistanceFunction<O,D extends Distance<D>>
public TypeInformation getInputTypeRestriction()
DistanceFunction
public boolean equals(Object obj)
equals
in class Object
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |