predict_MBatchKMeans {ClusterR}R Documentation

Prediction function for Mini-Batch-k-means

Description

Prediction function for Mini-Batch-k-means

Usage

predict_MBatchKMeans(data, CENTROIDS, fuzzy = FALSE)

Arguments

data

matrix or data frame

CENTROIDS

a matrix of initial cluster centroids. The rows of the CENTROIDS matrix should be equal to the number of clusters and the columns should equal the columns of the data.

fuzzy

either TRUE or FALSE. If TRUE then prediction probabilities will be calculated using the distance between observations and centroids.

Details

This function takes the data and the output centroids and returns the clusters.

Value

if fuzzy = TRUE the function returns a list with two attributes: a vector with the clusters and a matrix with cluster probabilities. Otherwise, it returns a vector with the clusters.

Author(s)

Lampros Mouselimis

Examples


data(dietary_survey_IBS)

dat = dietary_survey_IBS[, -ncol(dietary_survey_IBS)]

dat = center_scale(dat)

MbatchKm = MiniBatchKmeans(dat, clusters = 2, batch_size = 20, num_init = 5, early_stop_iter = 10)

pr = predict_MBatchKMeans(dat, MbatchKm$centroids, fuzzy = FALSE)


[Package ClusterR version 1.2.5 Index]