Base Class for a Collection of Models over a Sparsity Path
Source:R/NormalBlockCollectionSparsity.R
NormalBlockCollectionSparsity.RdShared scaffolding for NormalBlockVarCollectionSparsity and
NormalBlockMeanCollectionSparsity: the penalty grid, the warm-started
path traversal, the penalty lookup and the criteria plot. Model selection,
StARS included (stability selection, Liu et al. 2010), is shared: a family
only says on which covariance estimate the default penalty grid is read
(private$penalty_scale()), how to refit its path on a subsample with the
clustering held fixed (private$subsample_path()) and how to name the
nodes of its network (private$network_nodes()).
Super class
NormalBlockCollection -> NormalBlockCollectionSparsity
Active bindings
sparsity_detailsnumber, range and ratio of the penalties of the path
qnumber of blocks
blocksgroup matrix or number of blocks
sparsitylist of sparsity penalties
criteriaa data frame with the criteria of every model of the path, plus its StARS stability once
stability_selection()has runstability_pathselection probability of every edge at every penalty (StARS),
NULLuntilstability_selection()has runstabilitymean edge stability along the penalty path,
1 - mean(4 p (1 - p))over the edges;NAuntilstability_selection()has run
Methods
Inherited methods
NormalBlockCollectionSparsity$new()
Create a collection over a path of sparsity penalties.
By default, control$n_sparsity_penalties values on a log scale, from
the largest absolute (weighted) entry of a covariance estimate, which
removes every edge, down to control$min_ratio times it.
Usage
NormalBlockCollectionSparsity$new(
mydata,
blocks,
zero_inflation = FALSE,
control = NB_control()
)Arguments
mydataobject of NormalBlockData class, with responses and design matrix
blockseither a clustering matrix (known, fixed clustering) or a single integer (number of blocks to infer)
zero_inflationwhether the models of the path are zero-inflated
controlstructured list of parameters to handle sparsity control
NormalBlockCollectionSparsity$optimize()
optimizes every model in the sparsity path, warm-starting
each one (after the first) from the previous, adjacent penalty's
converged parameters (see the family's base class's warm_start_from())
instead of re-deriving everything from the heuristic clustering, the
way the generic NormalBlockCollection optimize() would. blocks
(hence q) is fixed across the whole path, only the sparsity penalty
changes, so the warm start is always between models of matching shape.
Usage
NormalBlockCollectionSparsity$optimize(
control = list(niter = 500, threshold = 1e-04, verbose = TRUE)
)NormalBlockCollectionSparsity$get_model()
returns the NormalBlockVarKnownClusters model corresponding to given penalty
NormalBlockCollectionSparsity$get_best_model()
Extract best model in the collection
Usage
NormalBlockCollectionSparsity$get_best_model(
crit = c("BIC", "EBIC", "ICL", "StARS"),
stability = 0.9
)NormalBlockCollectionSparsity$stability_selection()
Computes the stability path (StARS, Liu et al. 2010): the penalty path is refitted on subsamples of the observations, with the clustering held fixed, and the selection frequency of each edge is recorded at every penalty.
Arguments
subsamplesa list of vectors describing the subsamples. The number of vectors (or list length) determines the number of subsamples used in the stability selection. Automatically set to 10 subsamples with size
10*sqrt(n)ifn >= 144and0.8*notherwise following Liu et al. (2010) recommendations.n_subsamplesnumber of subsamples to create if the subsamples are not given
NormalBlockCollectionSparsity$plot()
Plot the criteria of the models of the path against the
penalty, with a dashed line at the penalty selected by each criterion
(see also plot.NormalBlockCollection()).
Usage
NormalBlockCollectionSparsity$plot(
criteria = c("deviance", "BIC", "EBIC", "ICL"),
log.x = TRUE
)Arguments
criteriathe criteria to plot, among
"deviance","BIC","EBIC"and"ICL"; all of them by default.log.xlogical: should the x-axis be represented in log-scale? Default is
TRUE.
Returns
a ggplot2::ggplot graph