View source: R/SparseClustering.R
| SparseClustering | R Documentation |
Implements the sparse clustering methods of [Witten/Tibshirani, 2010].
SparseClustering(DataOrDistances, ClusterNo = 0, Type = "Hierarchical",
ColorTreshold = 0, Silent = FALSE, NoPerms = 10,
Wbounds, PlotIt = FALSE, ...)
DataOrDistances |
Either a [1:n,1:d] matrix containing the dataset to be clustered, with n cases and d variables, or a symmetric [1:n,1:n] distance matrix. |
ClusterNo |
Numeric scalar specifying the number of clusters at which to
cut the tree when |
Type |
Optional character scalar selecting |
ColorTreshold |
A finite numeric scalar used when
|
Silent |
Optional logical scalar passed to the subordinate sparcl
functions' |
NoPerms |
Optional numeric scalar specifying the number of permutations. |
Wbounds |
Optional numeric vector defining the range of tuning parameters to consider. This is the L1 bound on the feature weights w [Witten/Tibshirani, 2010]. |
PlotIt |
If |
... |
Further arguments passed to
HierarchicalSparseCluster or
KMeansSparseCluster, depending on |
A list with the following components:
Cls |
A numerical vector of length n defining the classification. It has k unique values representing the arbitrary cluster labels. |
Object |
The object returned by the selected clustering algorithm. |
Dendrogram |
The hierarchical clustering tree when
|
Clustering quality can differ between sparse hierarchical clustering applied to raw data and the same method applied to precomputed distances.
Quirin Stier, Michael Thrun
[Witten/Tibshirani, 2010] Witten, D. and Tibshirani, R.: A Framework for Feature Selection in Clustering. Journal of the American Statistical Association, Vol. 105(490), pp. 713-726, 2010.
# Hepta
data("Hepta")
Data <- Hepta$Data
V1 <- SparseClustering(Data, ClusterNo = 7, Type = "kmeans")
Cls1 <- V1$Cls
V2 <- SparseClustering(Data, ClusterNo = 7, Type = "Hierarchical")
Cls2 <- V2$Cls
InputDistances <- parallelDist::parDist(Data, method = "euclidean")
DistanceMatrix <- as.matrix(InputDistances)
V3 <- SparseClustering(
DistanceMatrix,
ClusterNo = 7,
Type = "Hierarchical"
)
Cls3 <- V3$Cls
set.seed(1)
Data <- matrix(rnorm(100 * 50), ncol = 50)
y <- c(rep(1, 50), rep(2, 50))
Data[y == 1, 1:25] <- Data[y == 1, 1:25] + 2
V1 <- SparseClustering(Data, ClusterNo = 2, Type = "kmeans")
Cls1 <- V1$Cls
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.