Description Usage Arguments Value Author(s) See Also Examples
This function runs the l1-spectral clustering algorithm on one component only.
1 | l1_spectral(A, k, elements, pen, stab = TRUE)
|
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). |
The matrix of community indicators.
Camille Champion, Magali Champion
l1_spectralclustering
, l1spectral
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #########################################################
# 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.