Cluster Kmeans Module
Rust module: cuvs::cluster::kmeans
Source: rust/cuvs/src/cluster/kmeans/mod.rs
Kmeans clustering API’s
Example:
params::Params
Source: rust/cuvs/src/cluster/kmeans/mod.rs:40
fit
Find clusters with the k-means algorithm
Arguments
res- Resources to useparams- Parameters to use to fit KMeans modelx- A matrix in device memory - shape (m, k)sample_weight- Optional device matrix shape (n_clusters, 1)centroids- Output device matrix, that has the centroids for each cluster shape (n_clusters, k)
Source: rust/cuvs/src/cluster/kmeans/mod.rs:56
predict
Predict clusters with the k-means algorithm
Arguments
res- Resources to useparams- Parameters to use to fit KMeans modelx- Input matrix in device memory - shape (m, k)sample_weight- Optional device matrix shape (n_clusters, 1)centroids- Centroids calculated by fit in device memory, shape (n_clusters, k)labels- preallocated CUDA array interface matrix shape (m, 1) to hold the output labelsnormalize_weight- whether or not to normalize the weights
Source: rust/cuvs/src/cluster/kmeans/mod.rs:95
cluster_cost
Compute cluster cost given an input matrix and existing centroids
Arguments
res- Resources to usex- Input matrix in device memory - shape (m, k)centroids- Centroids calculated by fit in device memory, shape (n_clusters, k)
Source: rust/cuvs/src/cluster/kmeans/mod.rs:131