KMeansClustering {sharp}R Documentation

(Sparse) K-means clustering

Description

Runs k-means clustering using implementation from kmeans. This function is not using stability.

Usage

KMeansClustering(xdata, nc = NULL, Lambda = NULL, ...)

Arguments

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 implementation. If nc is not provided, it is set to seq(1, tau*nrow(xdata)).

Lambda

vector of penalty parameters (see argument wbounds in KMeansSparseCluster).

...

additional parameters passed to kmeans (if Lambda is NULL) or KMeansSparseCluster.

Value

A list with:

comembership

an array of binary and symmetric co-membership matrices.

weights

a matrix of median weights by feature.

References

Witten DM, Tibshirani R (2010). “A Framework for Feature Selection in Clustering.” Journal of the American Statistical Association, 105(490), 713-726. doi:10.1198/jasa.2010.tm09415, PMID: 20811510.

See Also

Other clustering algorithms: DBSCANClustering(), GMMClustering(), HierarchicalClustering(), PAMClustering()

Examples


# 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)
  )
}


[Package sharp version 1.4.6 Index]