| NormalBlockCollectionClusters | R Documentation |
Shared scaffolding for NormalBlockVarCollectionClusters and
NormalBlockMeanCollectionClusters: the models of the collection, one per
q in increasing order, model lookup and selection, the criteria plot and
the split/merge refine() search. Concrete subclasses only name the model
family.
NormalBlockCollection -> NormalBlockCollectionClusters
q_listnumber of blocks
deviance_violationsthe values of q whose deviance is higher
than at the previous q of the collection. The models being nested, each
one signals a poor local optimum, which refine() can repair.
NormalBlockCollectionClusters$new()Create a collection over a range of q, sorted increasingly.
NormalBlockCollectionClusters$new( mydata, q_list, zero_inflation = FALSE, sparsity = 0, control = NB_control() )
mydataobject of NormalBlockData class, with responses and design matrix
q_listvalues of q (number of clusters) in the collection
zero_inflationwhether the models of the collection are zero-inflated
sparsitysparsity penalty on the network density
controlstructured list of more specific parameters, to generate with NB_control
A new collection object
NormalBlockCollectionClusters$get_model()The model of the collection with q clusters.
NormalBlockCollectionClusters$get_model(q)
qa number of clusters among those of the collection ($q_list)
a fitted model, of the class of the collection's models
NormalBlockCollectionClusters$get_best_model()The best model of the collection for a criterion.
NormalBlockCollectionClusters$get_best_model(
crit = c("ICL", "BIC", "EBIC", "deviance")
)
critthe criterion minimized: "ICL" (the default), "BIC", "EBIC", or "deviance" (which always selects the largest q)
a copy of the selected fitted model
NormalBlockCollectionClusters$plot()Plot the criteria of the models of the collection
against q, with a dashed line at the q selected by each criterion (see
also plot.NormalBlockCollection()).
NormalBlockCollectionClusters$plot(
criteria = c("deviance", "ICL", "BIC", "EBIC")
)
criteriathe criteria to plot, among "deviance", "ICL",
"BIC" and "EBIC"; all of them by default.
a ggplot2::ggplot graph
NormalBlockCollectionClusters$optimize()optimizes every model in the collection, then – if
control$refine is TRUE (see NB_control(), the default) –
calls $refine() automatically, reporting in one line how many models
it improved.
NormalBlockCollectionClusters$optimize( control = list(niter = 500, threshold = 1e-04, verbose = TRUE) )
controloptimization parameters (niter, threshold, verbose)
NormalBlockCollectionClusters$refine()Tries to improve every model in the collection with a
short split-and-reoptimize trial seeded from its smaller-q neighbor
("split"), a short merge-and-reoptimize trial seeded from its
larger-q neighbor ("merge"), or both (the default); a candidate
replaces the original only if it strictly lowers the deviance, so this
can only improve (or leave unchanged) each model it touches. Only
contiguous q pairs (q and q -/+ 1, both present in the collection)
are refined. Run by default after fitting a collection, see
NB_control()'s refine for the rationale.
NormalBlockCollectionClusters$refine(
trial_niter = 2,
max_candidates = 30,
directions = c("split", "merge"),
verbose = self$control$verbose,
split_rule = NULL
)
trial_niternumber of EM iterations used for the cheap trial
candidates (passed to candidates_split()/candidates_merge())
before fully re-optimizing only the best one.
max_candidatespassed to candidates_merge() (ignored for
"split", which is never combinatorial in q) – see its
documentation.
directionswhich neighbor(s) to seed refinement candidates
from: "split" (smaller-q neighbor), "merge" (larger-q neighbor),
or both (the default).
verbosewhether to print, for each q attempted, whether the
candidate from that neighbor improved on it. Defaults to
control$verbose (the value set at construction, see
NB_control()).
split_rulehow a cluster is split to seed the q + 1 model, see
the rule argument of the models' split(): "kmeans", "noise",
or NULL (default) for the family's own default ("kmeans" for the
variance-block family, "noise" for the mean-block one).
invisibly returns self; improved models replace the
originals in $models in place.
NormalBlockCollectionClusters$print()User-friendly print method: as for any collection, plus a
warning line when the deviance increases with q somewhere (see
deviance_violations).
NormalBlockCollectionClusters$print()
NormalBlockCollectionClusters$clone()The objects of this class are cloneable with this method.
NormalBlockCollectionClusters$clone(deep = FALSE)
deepWhether to make a deep clone.
# An internal abstract base class, never instantiated directly -- see
# normal_block() for how collections are created and fitted.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.