predict_mini_batch_r {mbkmeans} | R 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)

[Package mbkmeans version 1.8.0 Index]