skglm.GraphicalLasso#
- class skglm.GraphicalLasso(alpha=1.0, weights=None, algo='dual', max_iter=100, tol=1e-08, warm_start=False, inner_tol=0.0001, verbose=False, solver='barebones')[source]#
Block Coordinate Descent (BCD) solver for the Graphical Lasso (GLasso) problem.
Implements the sparse inverse covariance estimation algorithm from Friedman et al. (2008) and its weighted/primal variant from Mazumder et al. (2012), supporting both primal and dual coordinate descent.
The problem is defined as:
`\Theta^* = \underset{\Theta \succ 0}{\arg\min}\ -\log\det(\Theta) + \langle S, \Theta \rangle + \alpha \sum_{i \ne j} w_{ij} |\Theta_{ij}|`where `S` is the empirical covariance matrix, `\Theta` the precision matrix, `\alpha` the regularisation strength, and `w_{ij}` optional positive weights (uniform when
weights=None
).- Parameters:
- alphafloat, default=1.0
Regularization strength.
- weightsndarray or None, default=None
Symmetric matrix of penalty weights, or None for uniform weights.
- algo{‘dual’, ‘primal’}, default=’dual’
Algorithm variant to use.
- max_iterint, default=100
Maximum number of coordinate descent iterations.
- tolfloat, default=1e-8
Convergence tolerance.
- warm_startbool, default=False
Use previous solution as initialization (primal only).
- inner_tolfloat, default=1e-4
Tolerance for inner solver.
- verbosebool, default=False
Print convergence info.
- Attributes:
- precision_ndarray
Estimated precision (inverse covariance) matrix.
- covariance_ndarray
Estimated covariance matrix.
- n_iter_int
Number of iterations run.
References
[1]Friedman et al., Biostatistics, 2008. https://doi.org/10.1093/biostatistics/kxm045
[2]Mazumder et al., Electron. J. Statist., 2012. https://doi.org/10.1214/12-EJS740
- __init__(alpha=1.0, weights=None, algo='dual', max_iter=100, tol=1e-08, warm_start=False, inner_tol=0.0001, verbose=False, solver='barebones')[source]#
Methods
__init__
([alpha, weights, algo, max_iter, ...])fit
(X[, y, mode])Fit the GraphicalLasso model.
get_metadata_routing
()Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
set_fit_request
(*[, mode])Configure whether metadata should be requested to be passed to the
fit
method.set_params
(**params)Set the parameters of this estimator.