MbkmeansParam-class: Mini-batch k-means clustering

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Run the mini-batch k-means mbkmeans function with the specified number of centers within clusterRows from the bluster Bioconductor package.

Usage

1
2
3
4
MbkmeansParam(centers, ...)

## S4 method for signature 'ANY,MbkmeansParam'
clusterRows(x, BLUSPARAM, full = FALSE)

Arguments

centers

An integer scalar specifying the number of centers. Alternatively, a function that takes the number of observations and returns the number of centers. Note, the mbkmeans function uses the argument clusters argument to represent this argument. However, we use centers to match

...

Further arguments to pass to mbkmeans.

x

A numeric matrix-like object where rows represent observations and columns represent variables.

BLUSPARAM

A MbkmeansParam object.

full

Logical scalar indicating whether the full mini-batch k-means statistics should be returned.

Details

TheclusterRows function from the bluster Bioconductor package is a generic that controls dispatch to different clustering algorithms. Here we add the option to use the mbkmeans clustering algorithm with clusterRows. This class usually requires the user to specify the number of clusters beforehand. However, we can also allow the number of clusters to vary as a function of the number of observations. The latter is occasionally useful, e.g., to allow the clustering to automatically become more granular for large datasets.

To modify an existing MbkmeansParam object x, users can simply call x[[i]] or x[[i]] <- value where i is any argument used in the constructor.

Value

The MbkmeansParam constructor will return a MbkmeansParam object with the specified parameters.

The clusterRows method will return a factor of length equal to nrow(x) containing the cluster assignments. If full=TRUE, a list is returned with clusters (the factor, as above) and objects; the latter will contain the direct output of mbkmeans.

Author(s)

Stephanie Hicks

See Also

mbkmeans, which actually does all the heavy lifting.

Examples

1
2
3
4
clusterRows(iris[,1:4], MbkmeansParam(centers=3))
clusterRows(iris[,1:4], MbkmeansParam(centers=3, batch_size=10))
clusterRows(iris[,1:4], MbkmeansParam(centers=3, batch_size=10, 
            compute_labels=TRUE, calc_wcss=TRUE))

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