faasle
faasle[^1] is a Rust package for evaluating distances (metrics) between multidimensional arrays. It is designed to be simple, fast, and easy to use.
Usage
use ;
use ;
let x =
from_shape_vec.unwrap;
let y =
from_shape_vec.unwrap;
let metric = new;
let distance = metric.evaluate.unwrap;
assert!;
Hierarchy of Types
Mathematically a distance metric is a function $d:\mathcal{X}\times\mathcal{X}\rightarrow\mathbb{R}$, where $\mathcal{X}$ is a set, such that they satisfy the following properties:
Positivity
- $d(x, y) \geq 0$ for all $x, y \in \mathcal{X}$,
- $d(x, y) = 0$ if and only if $x = y$,
Symmetry
- $d(x, y) = d(y, x)$ for all $x, y \in \mathcal{X}$,
Triangle Inequality
- $d(x, z) \leq d(x, y) + d(y, z)$ for all $x, y, z \in \mathcal{X}$.
The hierarchy of types and their properties are as follows:
PreMetric |
SemiMetric |
Metric |
|
|---|---|---|---|
| Positivity | ✅ | ✅ | ✅ |
| Symmetry | ❌ | ✅ | ✅ |
| Triangle Inequality | ❌ | ❌ | ✅ |
How to cite?
[^1]: Faasle is an Urdu word, which means distance in English. It is also the name of the infamous Coke Studio Season 10 song by Quratulain Balouch and Kaavish.