(metric: DistanceMetric)
| 449 | } |
| 450 | |
| 451 | pub fn max(metric: DistanceMetric) -> Self { |
| 452 | match metric { |
| 453 | DistanceMetric::Cosine => Self::CosineSimilarity(CosineSimilarity(2.0)), // take care of precision issues |
| 454 | DistanceMetric::Euclidean => Self::EuclideanDistance(EuclideanDistance(f32::INFINITY)), |
| 455 | DistanceMetric::Hamming => Self::HammingDistance(HammingDistance(f32::INFINITY)), |
| 456 | DistanceMetric::DotProduct => { |
| 457 | Self::DotProductDistance(DotProductDistance(f32::INFINITY)) |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | #[derive(Debug, Clone, Copy, serde::Deserialize, serde::Serialize)] |
no test coverage detected