Description Usage Arguments Value Note References See Also Examples
View source: R/ktaucenters_aux.R
Robust Clustering algorithm based on centers, a robust and efficient version of KMeans.
1 | ktaucenters_aux(X, K, centers, tolmin, NiterMax)
|
X |
A matrix of size n x p. |
K |
The number of clusters. |
centers |
matrix of size K x p containing the K initial centers, one at each matrix-row. |
tolmin |
tolerance parameter used for the algorithm stopping rule |
NiterMax |
a maximun number of iterations used for the algorithm stopping rule |
A list including the estimated K centers and labels for the observations
centers
: matrix of size K x p, with the estimated K centers.
cluster
: array of size n x 1 integers labels between 1 and K.
tauPath
: sequence of tau scale values at each iterations.
Wni
: numeric array of size n x 1 indicating the weights associated to each observation.
emptyClusterFlag
: a boolean value. True means that in some iteration there were clusters totally empty
niter
: number of iterations untill convergence is achived or maximun number of iteration is reached
di
distance of each observation to its assigned cluster-center
Some times, if the initial centers are wrong, the algorithm converges to a non-optimal (local) solution.
To avoid that, the algorithm must be run several times. This task is carried out by ktaucenters
Gonzalez, J. D., Yohai, V. J., & Zamar, R. H. (2019). Robust Clustering Using Tau-Scales. arXiv preprint arXiv:1906.08198.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Generate Sintetic data (three cluster well separated)
Z=rnorm(600);
mues=rep(c(0,10,20),200)
X= matrix(Z+mues,ncol=2)
# Applying the algortihm
sal = ktaucenters_aux(
X, K=3, centers=X[sample(1:300,3), ],
tolmin=1e-3, NiterMax=100)
#plot the results
plot(X,type="n")
points(X[sal$cluster==1,],col=1);
points(X[sal$cluster==2,],col=2);
points(X[sal$cluster==3,],col=3);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.