[][src]Module smartcore::math::distance

Multitude of distance metrics are defined here

Collection of Distance Functions

Many algorithms in machine learning require a measure of distance between data points. Distance metric (or metric) is a function that defines a distance between a pair of point elements of a set. Formally, the distance can be any metric measure that is defined as \( d(x, y) \geq 0\) and follows three conditions:

  1. \( d(x, y) = 0 \) if and only \( x = y \), positive definiteness
  2. \( d(x, y) = d(y, x) \), symmetry
  3. \( d(x, y) \leq d(x, z) + d(z, y) \), subadditivity or triangle inequality

for all \(x, y, z \in Z \)

A good distance metric helps to improve the performance of classification, clustering and information retrieval algorithms significantly.

Modules

euclidian

Euclidean Distance is the straight-line distance between two points in Euclidean spacere that presents the shortest distance between these points.

hamming

Hamming Distance between two strings is the number of positions at which the corresponding symbols are different.

mahalanobis

The Mahalanobis distance is the distance between two points in multivariate space.

manhattan

Also known as rectilinear distance, city block distance, taxicab metric.

minkowski

A generalization of both the Euclidean distance and the Manhattan distance.

Structs

Distances

Multitude of distance metric functions

Traits

Distance

Distance metric, a function that calculates distance between two points