O
- Database object typeD
- Distance typepublic class MinKDistance<O,D extends Distance<D>> extends AbstractDatabaseDistanceFunction<O,D>
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!
Modifier and Type | Class and Description |
---|---|
class |
MinKDistance.Instance<T extends O>
Instance for an actual database.
|
static class |
MinKDistance.Parameterizer<O,D extends Distance<D>>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
MinKDistance(DistanceFunction<? super O,D> parentDistance,
int k)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
<T extends O> |
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?
|
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
public MinKDistance(DistanceFunction<? super O,D> parentDistance, int k)
MinKDistance.Parameterizer
for factory.parentDistance
- distance function to usek
- K parameterpublic <T extends O> DistanceQuery<T,D> instantiate(Relation<T> relation)
DistanceFunction
relation
- The representation to useprotected D computeReachdist(List<DistanceResultPair<D>> neighborhood, D truedist)
neighborhood
- Neighborhoodtruedist
- True distancepublic boolean isMetric()
DistanceFunction
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