adelie.cv.CVGrpnetResult#
- class adelie.cv.CVGrpnetResult(lmdas: ndarray, losses: ndarray, avg_losses: ndarray, best_idx: int)[source]#
Result of K-fold CV group elastic net.
Methods
__init__
(lmdas, losses, avg_losses, best_idx)fit
(X, glm, **grpnet_params)Fits group elastic net until the best CV \(\lambda\).
Plots the average K-fold CV loss.
Attributes
The common regularization path used for all folds.
losses[k,i]
is the CV loss when validating on foldk
atlmdas[i]
.avg_losses[i]
is the average CV loss atlmdas[i]
.Argmin of
avg_losses
.- fit(X: ndarray | MatrixNaiveBase32 | MatrixNaiveBase64, glm: GlmBase32 | GlmBase64 | GlmMultiBase32 | GlmMultiBase64, **grpnet_params)[source]#
Fits group elastic net until the best CV \(\lambda\).
- Parameters:
- X(n, p) Union[ndarray, MatrixNaiveBase32, MatrixNaiveBase64]
Feature matrix. It is typically one of the matrices defined in
adelie.matrix
submodule ornumpy.ndarray
.- glmUnion[GlmBase32, GlmBase64, GlmMultiBase32, GlmMultiBase64]
GLM object. It is typically one of the GLM classes defined in
adelie.glm
submodule.- **grpnet_paramsoptional
Parameters to
adelie.solver.grpnet()
.
- Returns:
- state
Result of calling
adelie.solver.grpnet()
.
See also
- plot_loss()[source]#
Plots the average K-fold CV loss.
For each fitted \(\lambda\), the average K-fold CV loss as well as an error bar of one standard deviation (above and below) is plotted.
- lmdas: ndarray#
The common regularization path used for all folds.
- losses: ndarray#
losses[k,i]
is the CV loss when validating on foldk
atlmdas[i]
.
- avg_losses: ndarray#
avg_losses[i]
is the average CV loss atlmdas[i]
.
- best_idx: int#
Argmin of
avg_losses
.