View source: R/clustering_algorithms.R
KMeansClustering | R Documentation |
Runs k-means clustering using implementation from
kmeans
. This function is not using stability.
KMeansClustering(xdata, nc = NULL, Lambda = NULL, ...)
xdata |
data matrix with observations as rows and variables as columns. |
nc |
matrix of parameters controlling the number of clusters in the
underlying algorithm specified in |
Lambda |
vector of penalty parameters (see argument |
... |
additional parameters passed to |
A list with:
comembership |
an array of binary and symmetric co-membership matrices. |
weights |
a matrix of median weights by feature. |
SparseClusteringsharp
Other clustering algorithms:
DBSCANClustering()
,
GMMClustering()
,
HierarchicalClustering()
,
PAMClustering()
# Data simulation
set.seed(1)
simul <- SimulateClustering(n = c(10, 10), pk = 50)
# K means clustering
mykmeans <- KMeansClustering(xdata = simul$data, nc = seq_len(20))
# Sparse K means clustering
if (requireNamespace("sparcl", quietly = TRUE)) {
mykmeans <- KMeansClustering(
xdata = simul$data, nc = seq_len(20),
Lambda = c(2, 5)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.