pub struct CosineMergeScorer;Expand description
Simple cosine similarity scorer (CPU fallback).
Returns raw cosine similarity in [0, 1]. Thresholding is handled
externally (via MergeScorer::get_merges or call-site comparison).
Implementations§
Source§impl CosineMergeScorer
impl CosineMergeScorer
Sourcepub fn new() -> CosineMergeScorer
pub fn new() -> CosineMergeScorer
Create a new cosine similarity scorer.
Trait Implementations§
Source§impl Clone for CosineMergeScorer
impl Clone for CosineMergeScorer
Source§fn clone(&self) -> CosineMergeScorer
fn clone(&self) -> CosineMergeScorer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CosineMergeScorer
impl Debug for CosineMergeScorer
Source§impl Default for CosineMergeScorer
impl Default for CosineMergeScorer
Source§fn default() -> CosineMergeScorer
fn default() -> CosineMergeScorer
Returns the “default value” for a type. Read more
Source§impl MergeScorer for CosineMergeScorer
impl MergeScorer for CosineMergeScorer
Source§fn score(
&self,
cluster_a: &ClusterEmbedding,
cluster_b: &ClusterEmbedding,
) -> f32
fn score( &self, cluster_a: &ClusterEmbedding, cluster_b: &ClusterEmbedding, ) -> f32
Score the probability that two clusters should be merged. Read more
Source§fn score_batch(
&self,
clusters_a: &[ClusterEmbedding],
clusters_b: &[ClusterEmbedding],
) -> Vec<Vec<f32>>
fn score_batch( &self, clusters_a: &[ClusterEmbedding], clusters_b: &[ClusterEmbedding], ) -> Vec<Vec<f32>>
Batch scoring for efficiency.
Source§fn get_merges(
&self,
clusters_a: &[ClusterEmbedding],
clusters_b: &[ClusterEmbedding],
threshold: f32,
) -> Vec<(usize, usize, f32)>
fn get_merges( &self, clusters_a: &[ClusterEmbedding], clusters_b: &[ClusterEmbedding], threshold: f32, ) -> Vec<(usize, usize, f32)>
Get merge decisions above threshold.
Auto Trait Implementations§
impl Freeze for CosineMergeScorer
impl RefUnwindSafe for CosineMergeScorer
impl Send for CosineMergeScorer
impl Sync for CosineMergeScorer
impl Unpin for CosineMergeScorer
impl UnsafeUnpin for CosineMergeScorer
impl UnwindSafe for CosineMergeScorer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more