predict_mini_batch_r: Compute labels for mini-batch k-means

View source: R/compute_labels.R

predict_mini_batch_rR Documentation

Compute labels for mini-batch k-means

Description

Given a data matrix and a centroid matrix, it assigns each data point to the closest centroid, using block processing.

Usage

predict_mini_batch_r(
  data,
  centroids,
  BPPARAM = BiocParallel::SerialParam(),
  ...
)

Arguments

data

a matrix-like object with features in row and samples in columns.

centroids

a matrix with the coordinates of the centroids.

BPPARAM

for parallel computations. See the 'BiocParallel' package.

...

passed to 'blockApply'.

Value

a vector of cluster labels for each observation.

Examples


data(iris)
km <- mini_batch(as.matrix(iris[,1:4]), clusters = 3,
                 batch_size = 10, max_iters = 100)
predict_mini_batch_r(t(as.matrix(iris[,1:4])), km$centroids)

drisso/mbkmeans documentation built on April 6, 2022, 4:33 a.m.