l1_spectral {l1spectral} | R Documentation |
Run the l1-spectral clustering algorithm on one component
Description
This function runs the l1-spectral clustering algorithm on one component only.
Usage
l1_spectral(A, k, elements, pen, stab = TRUE)
Arguments
A |
The adjacency matrix of the graph to cluster. |
k |
The number of clusters. |
elements |
The representative elements of the connected component to cluster. |
pen |
The penalty (to be chosen among "lasso" and "thresholdedLS"). |
stab |
TRUE/FALSE indicating whether the representative elements should be stabilized (TRUE by default). |
Value
The matrix of community indicators.
Author(s)
Camille Champion, Magali Champion
See Also
l1_spectralclustering
, l1spectral
.
Examples
#########################################################
# Performing the l1-spectral clustering on one component
#########################################################
# 1st: create data
Data <- CreateDataSet(k=3, n=20, p=list(p_inside=0.1,p_outside=0.1))
# 2nd: find the structure, the opt number of clusters and the representative elements
Structure <- FindStructure(Data$A_hat)
Clusters <- FindNbrClusters(A = Data$A_hat, structure = Structure)
Elements <- FindElement(A = Data$A_hat, structure = Structure, clusters = Clusters)
Structure_tmp <- Structure$groups[[1]] # the first component
A_tmp <- Data$A_hat[Structure$groups[[1]],Structure$groups[[1]]]
k <- Clusters$nbr_clusters$Component1 # number of clusters to create
Elements_tmp <- list(score = Elements$score$Component1,
indices = Elements$indices$Component1)
# the elements of the first component
# 3rd: perform the l1-spectral clustering algorithm
# (with stabilization, which is the most recommended setting)
comm <- l1_spectral(A = A_tmp, k = k, elements = Elements_tmp, pen = "lasso", stab=TRUE)
[Package l1spectral version 0.99.6 Index]