The Hartigan-Wong version of the k-means algorithm uses two auxiliary algorithms: the optimal transfer stage (optra) and the quick transfer stage (qtran).
This function is the qtran subroutine adapted to the shape analysis context. It is used within HartiganShapes
. See Hartigan and Wong (1979) for details of the original k-means algorithm and Amaral et al. (2010) for details about its adaptation to shape analysis.
qtranShapes(array3D,n,c,ic1,ic2,nc,an1,an2,ncp,d,itran,indx)
A list with the following elements:: c,ic1,ic2,nc,an1,an2,ncp,d,itran,indx,icoun, updated after the optimal transfer stage. Note that icoun counts the steps where a re-allocation took place.
Array with the 3D landmarks of the sample objects.
Number of sample objects.
Array of centroids.
The cluster to each object belongs.
This vector is used to remember the cluster which each object is most likely to be transferred to at each step.
Number of objects in each cluster.
$an1(l) = nc(l) / (nc(l) - 1), l=1,...,numClust$, where numClust is the number of clusters.
$an2(l) = nc(l) / (nc(l) + 1), l=1,...,numClust$.
In the optimal transfer stage, ncp(l) stores the step at which cluster l is last updated, $l=1,...,numClust$.
In the quick transfer stage, ncp(l) stores the step at which cluster l is last updated plus n, $l=1,...,numClust$.
Vector of distances from each object to every centroid.
itran(l) = 1 if cluster l is updated in the quick-transfer stage (0 otherwise), $l=1,...,k$.
Number of steps since a transfer took place.
Guillermo Vinue
Vinue, G., Simo, A., and Alemany, S., (2016). The k-means algorithm for 3D shapes with an application to apparel design, Advances in Data Analysis and Classification 10(1), 103--132.
Hartigan, J. A., and Wong, M. A., (1979). A K-Means Clustering Algorithm, Applied Statistics, 100--108.
Amaral, G. J. A., Dore, L. H., Lessa, R. P., and Stosic, B., (2010). k-Means Algorithm in Statistical Shape Analysis, Communications in Statistics - Simulation and Computation 39(5), 1016--1026.
Dryden, I. L., and Mardia, K. V., (1998). Statistical Shape Analysis, Wiley, Chichester.
HartiganShapes