| mset_kmeans | R Documentation |
The function generates a software abstraction of a list of clustering
models implemented through a set of tuned methods and algorithms.
In particular, it generates a list of
kmeans-type functions each combining tuning
parameters and other algorithmic settings.
The generated functions are ready to be called on the data set.
mset_kmeans(
K = c(1:10),
iter.max = 50,
nstart = 30,
algorithm = "Hartigan-Wong",
trace = FALSE
)
K |
a vector, specifies the number of clusters. |
iter.max |
a vector, contains the settings of the |
nstart |
a vector, contains the settings of the |
algorithm |
a vector, contains the settings of the |
trace |
a vector, contains the settings of the |
The function produces functions implementing competing clustering methods
based on the K-Means methodology as implemented in
kmeans.
This is a specialized version of the more general function
mset_user.
In particular, it produces a list of kmeans functions
each corresponding to a specific setup in terms of
hyper-parameters (e.g. the number of clusters) and algorithm's
control parameters (e.g. initialization).
See kmeans for a detailed description of the role of
each argument and their data types.
Each combination of tuning parameters yields one element of the returned
qcmethod object.
In the generated fn, the params component is built from the
returned partition via clust2params.
An S3 object of class 'qcmethod'. Each element of the list
represents a competing method containing the following objects
fullname |
a string identifying the setup. |
callargs |
a list with |
fn |
the function implementing the specified setting. This |
Coraggio, Luca, and Pietro Coretto (2023). Selecting the Number of Clusters, Clustering Models, and Algorithms. A Unifying Approach Based on the Quadratic Discriminant Score. Journal of Multivariate Analysis, Vol. 196(105181), pp. 1-20, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jmva.2023.105181")}
kmeans, mset_user, bqs
# 'kmeans' settings combining number of clusters K={2,3}
# and numbers of random starts {10,20}
A <- mset_kmeans(K = c(2,3), nstart = c(10,20))
# select setup 1: K=2, nstart = 10
m <- A[[1]]
print(m)
# cluster with the method set in 'm'
data("banknote")
dat <- banknote[-1]
fit1 <- m$fn(dat)
fit1
class(fit1)
# if only cluster parameters are needed
fit2 <- m$fn(dat, only_params = TRUE)
fit2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.