ML Distance
This Rust crate is based on the paper Comprehensive Survey on Distance/Similarity Measures between Probability Density Functions and implemented to port the ml-distance pkg from js/ts to rust.
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
And place this in your code:
let a: = ;
let b: = ;
let distance = euclidean;
assert_eq!;
Can be used with any
Tthat implementInto<f64>, (e.g.let a = vec![1,4,2]works etc.)
Distances Implemented
| Name | Formula Link | Status |
|---|---|---|
| euclidean | Link | ✅ |
| manhattan | Link | ✅ |
| minkowski | Link | ✅ |
| chebyshev | Link | ✅ |
| sorensen | Link | ✅ |
| gower | Link | ✅ |
| soergel | Link | ✅ |
| kulczynski | Link | ✅ |
| canberra | Link | ✅ |
| lorentzian | Link | ✅ |
| intersection | Link | ✅ |
| waveHedges | Link | ✅ |
| czekanowski | Link | ✅ |
| motyka | Link | ✅ |
| ruzicka | Link | ✅ |
| tanimoto | Link | 🔜 |
| innerProduct | Link | ✅ |
| harmonicMean | Link | ✅ |
| cosine | Link | ✅ |
| kumarHassebrook | Link | 🔜 |
| jaccard | Link | 🔜 |
| dice | Link | 🔜 |
| fidelity | Link | 🔜 |
| bhattacharyya | Link | 🔜 |
| hellinger | Link | 🔜 |
| matusita | Link | 🔜 |
| squaredChord | Link | 🔜 |
| squaredEuclidean | Link | 🔜 |
| pearson | Link | 🔜 |
| neyman | Link | 🔜 |
| squared | Link | 🔜 |
| probabilisticSymmetric | Link | 🔜 |
| divergence | Link | 🔜 |
| clark | Link | 🔜 |
| additiveSymmetric | Link | 🔜 |
| kullbackLeibler | Link | 🔜 |
| jeffreys | Link | 🔜 |
| kdivergence | Link | 🔜 |
| topsoe | Link | 🔜 |
| jensenShannon | Link | 🔜 |
| jensenDifference | Link | 🔜 |
| taneja | Link | 🔜 |
| kumarJohnson | Link | 🔜 |
| avg | Link | 🔜 |
Similarities Implemented
| Name | Formula Link | Status |
|---|---|---|
| intersection | Link | 🔜 |
| czekanowski | Link | 🔜 |
| motyka | Link | 🔜 |
| kulczynski | Link | 🔜 |
| squaredChord | Link | 🔜 |
| jaccard | Link | 🔜 |
| dice | Link | 🔜 |
| tanimoto | Link | 🔜 |