View source: R/sampleCompute.R
computeEM | R Documentation |
Perform Expectation-Maximization clustering, dealing with the number of clusters K, automatically or not.
computeEM( x, K = 0, K.max = 20, kmeans.variance.min = 0.95, graph = FALSE, Mclust.options = list() )
x |
matrix of raw data (point by line). |
K |
number of clusters. If K=0 (default), this number is automatically computed thanks to the Elbow method. |
K.max |
maximal number of clusters (K.Max=20 by default). |
kmeans.variance.min |
elbow method cumulative explained variance > criteria to stop K-search. |
graph |
boolean: if TRUE, figures for total of within-class inertia and explained variance are plotted. |
Mclust.options |
list of default parameters values for the function Mclust. |
computeEM performs Expectation-Maximization clustering, dealing with the number of clusters K, automatically or not
res.EM results obtained from Mclust algorithm.
computeUnSupervised
, computeKmeans
dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2)) tf <- tempfile() write.table(dat, tf, sep=",", dec=".") x <- importSample(file.features=tf) res.em <- computeEM(x$features$initial$x, K=0, graph=TRUE) plot(dat[,1], dat[,2], type = "p", xlab = "x", ylab = "y", col = res.em$classification, main = "EM clustering")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.