Perform HTK-means clustering (Raymaekers and Zamar, 2022) on a data matrix.
HTKmeans(X, k, lambdas = NULL,
standardize = TRUE,
iter.max = 100, nstart = 100,
nlambdas = 50,
lambda_max = 1,
verbose = FALSE)A list with components:
HTKmeans.out
A list with length equal to the number of lambda values supplied in lambdas.
Each element of this list is in turn a list containing
centers A matrix of cluster centres.
cluster A vector of integers (from 1:k) indicating the cluster to which each point is allocated.
itnb The number of iterations executed until convergence
converged Whether the algorithm stopped by converging or through reaching the maximum number of itertions.
inputargs
the input arguments to the function.
a matrix containing the data.
the number of clusters.
a vector of values for the regularization parameter lambda.
Defaults to NULL, which generates a sequence of values automatically.
logical flag for standardization to mean 0 and variance 1 of
the data in X. This is recommended, unless the variance
of the variables is known to quantify relevant information.
the maximum number of iterations allowed.
number of starts used when k-means is applied to generate the starting values for HTK-means. See below for more info.
Number of lambda values to generate automatically.
Maximum value for the regularization paramater \(lambda\). If
standardize = TRUE, the default of 1 works well.
Whether or not to print progress. Defaults to FALSE.
J. Raymaekers and R.H. Zamar
The algorithm starts by generating a number of sparse starting values. This is done using k-means on subsets of variables. See Raymaekers and Zamar (2022) for details.
Raymaekers, Jakob, and Ruben H. Zamar. "Regularized K-means through hard-thresholding." arXiv preprint arXiv:2010.00950 (2020).
X <- iris[, 1:4]
HTKmeans.out <- HTKmeans(X, k = 3, lambdas = 0.8)
HTKmeans.out[[1]]$centers
pairs(X, col = HTKmeans.out[[1]]$cluster)
Run the code above in your browser using DataLab