See: Description
Interface  Description 

DBIDDistanceFunction 
Distance functions valid in a database context only (i.e. for DBIDs)
For any "distance" that cannot be computed for arbitrary objects, only those
that exist in the database and referenced by their ID.

DBIDRangeDistanceFunction 
Distance functions valid in a static database context only
(i.e. for DBIDRanges)
For any "distance" that cannot be computed for arbitrary objects, only those
that exist in the database and referenced by their ID.

DistanceFunction<O> 
Base interface for any kind of distances.

IndexBasedDistanceFunction<O> 
Distance function relying on an index (such as preprocessed neighborhoods).

IndexBasedDistanceFunction.Instance<T,I extends Index> 
Instance interface for Index based distance functions.

Norm<O> 
Abstract interface for a mathematical norm.

NumberVectorDistanceFunction<O> 
Base interface for the common case of distance functions defined on numerical
vectors.

PrimitiveDistanceFunction<O> 
Primitive distance function that is defined on some kind of object.

SpatialPrimitiveDistanceFunction<V extends SpatialComparable> 
API for a spatial primitive distance function.

WeightedNumberVectorDistanceFunction<V> 
Distance functions where each dimension is assigned a weight.

Class  Description 

AbstractDatabaseDistanceFunction<O> 
Abstract super class for distance functions needing a database context.

AbstractDatabaseDistanceFunction.Instance<O> 
The actual instance bound to a particular database.

AbstractDBIDRangeDistanceFunction 
Abstract base class for distance functions that rely on integer offsets
within a consecutive range.

AbstractIndexBasedDistanceFunction<O,F extends IndexFactory<O>> 
Abstract super class for distance functions needing a database index.

AbstractIndexBasedDistanceFunction.Instance<O,I extends Index,F extends DistanceFunction<? super O>> 
The actual instance bound to a particular database.

AbstractIndexBasedDistanceFunction.Parameterizer<F extends IndexFactory<?>> 
Parameterization class.

AbstractNumberVectorDistanceFunction 
Abstract base class for the most common family of distance functions: defined
on number vectors and returning double values.

ArcCosineDistanceFunction 
Arcus cosine distance function for feature vectors.

ArcCosineDistanceFunction.Parameterizer 
Parameterization class.

ArcCosineUnitlengthDistanceFunction 
Arcus cosine distance function for feature vectors.

ArcCosineUnitlengthDistanceFunction.Parameterizer 
Parameterization class.

BrayCurtisDistanceFunction 
BrayCurtis distance function / SĂ¸rensenâ€“Dice coefficient for continuous
vector spaces (not only binary data).

BrayCurtisDistanceFunction.Parameterizer 
Parameterization class.

CanberraDistanceFunction 
Canberra distance function, a variation of Manhattan distance.

CanberraDistanceFunction.Parameterizer 
Parameterization class.

ClarkDistanceFunction 
Clark distance function for vector spaces.

ClarkDistanceFunction.Parameterizer 
Parameterization class.

CosineDistanceFunction 
Cosine distance function for feature vectors.

CosineDistanceFunction.Parameterizer 
Parameterization class.

CosineUnitlengthDistanceFunction 
Cosine distance function for unit length feature vectors.

CosineUnitlengthDistanceFunction.Parameterizer 
Parameterization class.

MahalanobisDistanceFunction 
Mahalanobis quadratic form distance for feature vectors.

MatrixWeightedQuadraticDistanceFunction 
Matrix weighted quadratic distance, the squared form of
MahalanobisDistanceFunction . 
RandomStableDistanceFunction 
This is a dummy distance providing random values (obviously not metrical),
useful mostly for unit tests and baseline evaluations: obviously this
distance provides no benefit whatsoever.

RandomStableDistanceFunction.Parameterizer 
Parameterization class.

SharedNearestNeighborJaccardDistanceFunction<O> 
SharedNearestNeighborJaccardDistanceFunction computes the Jaccard
coefficient, which is a proper distance metric.

SharedNearestNeighborJaccardDistanceFunction.Instance<T> 
Actual instance for a dataset.

SharedNearestNeighborJaccardDistanceFunction.Parameterizer<O> 
Parameterization class.

WeightedCanberraDistanceFunction 
Weighted Canberra distance function, a variation of Manhattan distance.

WeightedCanberraDistanceFunction.Parameterizer 
Parameterization class.

There are three basic types of distance functions:
Primitive Distance Function
s that can be computed for any two objects.DBID Distance Function
s, that are only defined for object IDs, e.g. an external distance matrixIndexBased Distance Function
s, that require an indexing/preprocessing step, and are then valid for existing database objects.
As a 'consumer' of distances, you usually do not care about the type of distance function you
want to use. To facilitate this, a distance function can be bound to a database by calling
the 'instantiate' method to obtain a DistanceQuery
object.
A distance query is a besteffort adapter for the given distance function. Usually, you pass it
two DBIDs and get the distance value back. When required, the adapter will get the appropriate
records from the database needed to compute the distance.
Note: instantiating a preprocessor based distance will invoke the preprocessing step. It is recommended to do this as soon as possible, and only instantiate the query once, then pass the query object through the various methods.
DistanceQuery<V> distanceQuery = database.getDistanceQuery(EuclideanDistanceFunction.STATIC);
Copyright © 2019 ELKI Development Team. License information.