pub enum Metric {
Cosine,
Euclidean,
DotProduct,
Jaccard,
}Expand description
How distance is measured.
Variants§
Cosine
Euclidean
DotProduct
Jaccard
Jaccard distance over sparse vectors (weighted: 1 - Σmin / Σmax).
Implementations§
Source§impl Metric
impl Metric
pub const ALL: [Self; 4]
pub fn iri(self) -> String
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parses a name (cosine, euclidean/l2, dot/dot_product, jaccard).
pub fn from_iri(iri: &str) -> Option<Self>
Sourcepub fn distance_fn(self) -> &'static str
pub fn distance_fn(self) -> &'static str
The SQL distance function.
Sourcepub fn score_sql(self, d: &str) -> String
pub fn score_sql(self, d: &str) -> String
The similarity score of a distance d, as Neo4j defines it: higher is nearer.
Sourcepub fn score(self, d: f64) -> f64
pub fn score(self, d: f64) -> f64
Self::score_sql in Rust.
Trait Implementations§
impl Copy for Metric
impl Eq for Metric
Source§impl Ord for Metric
impl Ord for Metric
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Metric
impl PartialOrd for Metric
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