Description Usage Arguments Value References Examples
Solves the K-means problem using kmeans++ for the initialization and then runs Lloyd's algorithm.
1 | gforce.kmeans(X, K, R_only = FALSE)
|
X |
n x m matrix. Each row is treated as a point in R^m. |
K |
integer. The number of clusters to group the data into. |
R_only |
logical expression. If |
Returns an object with the components:
clustersa n dimensional integer vector. Entry i to the cluster assignment of the data point given by row i of X.
centersa K x m numeric matrix. Row i corresponds to the center of cluster i.
num_itersan integer. Number of iterations of Lloyd's Algorithm.
timea numeric. Runtime of Lloyd's Algorithm.
S.P. Lloyd. Least Squares Quantization in PCM. IEEE Transactions on Information Theory, 1982.
D. Arthur and S. Vassilvitskii. k-means++: The Advantages of Careful Seeding. SODA, 2007.
1 2 3 4 | m <- 10
n <- 10
X <- matrix(MASS::mvrnorm(m*n,rep(0,m*n),diag(m*n)), nrow = n)
km_res <- gforce.kmeans(X,3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.