Skip to main content

cuvsKMeansFit

Function cuvsKMeansFit 

Source
pub unsafe extern "C" fn cuvsKMeansFit(
    res: cuvsResources_t,
    params: cuvsKMeansParams_t,
    X: *mut DLManagedTensor,
    sample_weight: *mut DLManagedTensor,
    centroids: *mut DLManagedTensor,
    inertia: *mut f64,
    n_iter: *mut c_int,
) -> cuvsError_t
Expand description

@brief Find clusters with k-means algorithm.

Initial centroids are chosen with k-means++ algorithm. Empty clusters are reinitialized by choosing new centroids with k-means++ algorithm.

X may reside on either host (CPU) or device (GPU) memory. When X is on the host the data is streamed to the GPU in batches controlled by params->streaming_batch_size.

@param[in] res opaque C handle @param[in] params Parameters for KMeans model. @param[in] X Training instances to cluster. The data must be in row-major format. May be on host or device memory. [dim = n_samples x n_features] @param[in] sample_weight Optional weights for each observation in X. Must be on the same memory space as X. [len = n_samples] @param[inout] centroids [in] When init is InitMethod::Array, use centroids as the initial cluster centers. [out] The generated centroids from the kmeans algorithm are stored at the address pointed by ‘centroids’. Must be on device. [dim = n_clusters x n_features] @param[out] inertia Sum of squared distances of samples to their closest cluster center. @param[out] n_iter Number of iterations run.