Skip to content

[source]

Minkowski#

The Minkowski distance can be considered as a generalization of both the Euclidean and Manhattan distances. When the lambda parameter is set to 1 or 2, the distance is equivalent to Manhattan and Euclidean respectively.

\[ {\displaystyle Minkowski\left(a,b\right)=\left(\sum _{i=1}^{n}|a_{i}-b_{i}|^{p}\right)^{\frac {1}{p}}} \]

Data Type Compatibility: Continuous

Parameters#

# Name Default Type Description
1 lambda 3.0 float Controls the curvature of the unit circle drawn from a point at a fixed distance.

Example#

use Rubix\ML\Kernels\Distance\Minkowski;

$kernel = new Minkowski(4.0);

Last update: 2021-01-25