predict_mini_batch_r: Compute labels for mini-batch k-means

Description Usage Arguments Value Examples

View source: R/compute_labels.R

Description

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

Usage

1
2
3
4
5
6
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

1
2
3
4
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)

mbkmeans documentation built on Nov. 15, 2020, 2:07 a.m.