pub enum Metric {
}Expand description
A distance between two vectors u and v.
Variants§
Euclidean
‖u − v‖₂.
SqEuclidean
‖u − v‖₂².
Cityblock
Σ |uᵢ − vᵢ| (Manhattan).
Chebyshev
max |uᵢ − vᵢ|.
Minkowski(f64)
(Σ |uᵢ − vᵢ|^p)^{1/p}, p ≥ 1.
SEuclidean(Vec<f64>)
√(Σ (uᵢ − vᵢ)² / Vᵢ), with given component variances V.
Mahalanobis(Vec<Vec<f64>>)
√((u − v)ᵀ VI (u − v)), with the inverse covariance matrix VI (rows).
Cosine
1 − u·v / (‖u‖ ‖v‖).
Correlation
1 − the Pearson correlation of u and v.
Canberra
Σ |uᵢ − vᵢ| / (|uᵢ| + |vᵢ|), terms with 0/0 omitted.
BrayCurtis
Σ |uᵢ − vᵢ| / Σ |uᵢ + vᵢ|.
Hamming
The fraction of components that differ.
Jaccard
Treating the vectors as booleans (non-zero or not), the fraction of components where exactly one is non-zero among those where either is (SciPy converts to booleans too).
Trait Implementations§
impl StructuralPartialEq for Metric
Auto Trait Implementations§
impl Freeze for Metric
impl RefUnwindSafe for Metric
impl Send for Metric
impl Sync for Metric
impl Unpin for Metric
impl UnsafeUnpin for Metric
impl UnwindSafe for Metric
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more