pub trait Metric<T> {
type Error: Error;
// Required method
fn distance(&self, value: &T) -> Result<f64, Self::Error>;
}
Required Associated Types§
Required Methods§
Sourcefn distance(&self, value: &T) -> Result<f64, Self::Error>
fn distance(&self, value: &T) -> Result<f64, Self::Error>
Returns a floating-point value that represents the “goodness” of the input with respect to some criteria
In general, the sign of the value indicates whether the input is good or bad, and the magnitude of the value represents how good/bad the input is. Representation in this fashion allows for the use of optimization algorithms to find the best input.