kmeans.torus
implements extrinsic k-means clustering
on toroidal space.
kmeans.torus(data, centers = 10, ...)# S3 method for kmeans.torus
predict(object, newdata, ...)
n x d matrix of toroidal data on \([0, 2\pi)^d\)
either the number of clusters or a set of initial cluster centers. If a number, a random set of row in x is chosen as the initial centers.
additional parameter
kmeans.torus
object
n x d matrix of toroidal data on \([0, 2\pi)^d\).
Dimension d must be the same as data used for kmeans.torus
object.
returns a kmeans
object, which contains
extrinsic.results
extrinsic k-means clustering results using ordinary kmeans algorithm.
centers
A matrix of cluster centers.
membership
A vector of integers indicating the cluster to which each point is allocated.
size
The number of points in each cluster.
withinss
Vector of within-cluster sum of squares, one component per cluster.
totss
The total sum of squares, based on angular distance.
betweenss
The between-cluster sum of squares.
In Euclidean space, we know that the total sum of squares is equal to the summation of the within cluster sum of squares and the between cluster centers sum of squares. However, toroidal space does not satisfy the property; the equality does not hold. Thus, you need to be careful to use the sum of squares.
Extrinsic k-means algorithm uses the ambient space for \([0, 2\pi)^d\). Each datum is transformed to a vector in 2d-dimensional Euclidean space, whose elements are sine and cosine values of the datum, then a usual k-means algorithm is applied to transformed data.
Jung, S., Park, K., & Kim, B. (2021). Clustering on the torus by conformal prediction. The Annals of Applied Statistics, 15(4), 1583-1603.
Gao, Y., Wang, S., Deng, M., & Xu, J. (2018). RaptorX-Angle: real-value prediction of protein backbone dihedral angles through a hybrid method of clustering and deep learning. BMC bioinformatics, 19(4), 73-84.
# NOT RUN {
data <- ILE[1:200, 1:2]
kmeans.torus(data, centers = 2,
iter.max = 100, nstart = 1)
# }
Run the code above in your browser using DataLab