pub struct ClusteringService { /* private fields */ }Expand description
Service for clustering embeddings.
Supports HDBSCAN and K-means clustering algorithms with automatic prototype computation and cluster quality metrics.
Implementations§
Source§impl ClusteringService
impl ClusteringService
Sourcepub fn new(config: ClusteringConfig) -> Self
pub fn new(config: ClusteringConfig) -> Self
Create a new clustering service with the given configuration.
Sourcepub fn default_service() -> Self
pub fn default_service() -> Self
Create with default configuration.
Sourcepub async fn run_hdbscan(
&self,
embeddings: &[EmbeddingWithId],
) -> Result<Vec<Cluster>>
pub async fn run_hdbscan( &self, embeddings: &[EmbeddingWithId], ) -> Result<Vec<Cluster>>
Sourcepub async fn run_kmeans(
&self,
embeddings: &[EmbeddingWithId],
k: usize,
) -> Result<Vec<Cluster>>
pub async fn run_kmeans( &self, embeddings: &[EmbeddingWithId], k: usize, ) -> Result<Vec<Cluster>>
Sourcepub async fn assign_to_nearest(
&self,
embedding: &[f32],
clusters: &[Cluster],
) -> Result<ClusterId>
pub async fn assign_to_nearest( &self, embedding: &[f32], clusters: &[Cluster], ) -> Result<ClusterId>
Sourcepub async fn compute_prototypes(
&self,
cluster: &Cluster,
embeddings: &HashMap<EmbeddingId, Vec<f32>>,
) -> Result<Vec<Prototype>>
pub async fn compute_prototypes( &self, cluster: &Cluster, embeddings: &HashMap<EmbeddingId, Vec<f32>>, ) -> Result<Vec<Prototype>>
Sourcepub async fn cluster_with_metrics(
&self,
embeddings: &[EmbeddingWithId],
) -> Result<ClusteringResult>
pub async fn cluster_with_metrics( &self, embeddings: &[EmbeddingWithId], ) -> Result<ClusteringResult>
Run full clustering pipeline with metrics.
Auto Trait Implementations§
impl Freeze for ClusteringService
impl RefUnwindSafe for ClusteringService
impl Send for ClusteringService
impl Sync for ClusteringService
impl Unpin for ClusteringService
impl UnwindSafe for ClusteringService
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