R/clustering_functions.R
predict_GMM.Rd
Prediction function for a Gaussian Mixture Model object
predict_GMM(data, CENTROIDS, COVARIANCE, WEIGHTS)
# S3 method for GMMCluster
predict(object, newdata, ...)
matrix or data frame
matrix or data frame containing the centroids (means), stored as row vectors
matrix or data frame containing the diagonal covariance matrices, stored as row vectors
vector containing the weights
arguments for the `predict` generic
a list consisting of the log-likelihoods, cluster probabilities and cluster labels.
This function takes the centroids, covariance matrix and weights from a trained model and returns the log-likelihoods, cluster probabilities and cluster labels for new data.
data(dietary_survey_IBS)
dat = as.matrix(dietary_survey_IBS[, -ncol(dietary_survey_IBS)])
dat = center_scale(dat)
gmm = GMM(dat, 2, "maha_dist", "random_subset", 10, 10)
# pr = predict_GMM(dat, gmm$centroids, gmm$covariance_matrices, gmm$weights)