Description Usage Arguments Format Value Note References See Also Examples
Robust Clustering algorithm based on centers, a robust and efficient version of K-Means.
1 |
data |
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. |
tolerance |
tolerance parameter used for the algorithm stopping rule |
max_iter |
a maximum number of iterations used for the algorithm stopping rule |
An object of class numeric
of length 1.
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.
empty_cluster_flag
: a boolean value. True means
that in some iteration there were clusters totally empty
niter
: number of iterations until convergence
is achived or maximum 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 Synthetic data (three cluster well separated)
Z=rnorm(600);
mues=rep(c(0,10,20),200)
data= matrix(Z+mues,ncol=2)
# Applying the algorithm
sal = ktaucenters_aux(
data, K=3, centers=data[sample(1:300,3), ],
tolerance=1e-3, max_iter=100)
#plot the results
plot(data,type='n')
points(data[sal$cluster==1,],col=1);
points(data[sal$cluster==2,],col=2);
points(data[sal$cluster==3,],col=3);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.