Package elki.distance

Distance functions for use within ELKI.

Distance functions

There are three basic types of distance functions:

These types differ significantly in both implementation and use.

Using distance functions

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 best-effort 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.

Code example

DistanceQuery<V> distanceQuery = database.getDistanceQuery(EuclideanDistance.STATIC);