Package de.lmu.ifi.dbs.elki.distance.distancefunction

Distance functions for use within ELKI.

See: Description


Package de.lmu.ifi.dbs.elki.distance.distancefunction Description

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, DoubleDistance> distanceQuery = database.getDistanceQuery(EuclideanDistanceFunction.STATIC);
 
Release 0.6.0 (2014-01-10_1610)