This function is the main function for fitting Dlvms with greed. In the simplest case you may only provide a dataset and greed will find a suitable one. The accepted classes for X depends on the generative used which can be specified with the model argument. See the DlvmPrior-class and the derived classes for details.

Greed enables the clustering of networks and count data matrix with different models. Model selection and clustering are performed in combination by optimizing the Integrated Classification Likelihood. Optimization is performed thanks to a combination of greedy local search and a genetic algorithm. The main entry point is the greed function to perform the clustering, which is documented below. The package also provides sampling functions for all the implemented DLVMs.

greed(X, model = find_model(X), K = 20, alg = Hybrid(), verbose = FALSE)

Arguments

X

data to cluster either a data.frame, a matrix, an array, ... depending on the used generative model

model

a generative model to fit such as Gmm,Sbm,..

K

initial number of cluster

alg

an optimization algorithm of class Alg-class such as Hybrid-class (default), Multistarts-class, Seed-class or Genetic-class

verbose

boolean value for verbose mode

Value

an IclPath-class object

See also

Examples

sbm <- rsbm(50, c(0.5, 0.5), diag(2) * 0.1 + 0.01)
sol <- greed(sbm$x, model = Sbm())
#> 
#> ── Fitting a guess SBM model ──
#> 
#> ℹ Initializing a population of 20 solutions.
#> ℹ Generation 1 : best solution with an ICL of -524 and 2 clusters.
#> ℹ Generation 2 : best solution with an ICL of -524 and 2 clusters.
#> ── Final clustering ──
#> 
#> ── Clustering with a SBM model 2 clusters and an ICL of -524 
table(sbm$cl,clustering(sol))
#>    
#>      1  2
#>   1  2 19
#>   2 28  1