Fit lasso logistic regression with stored standardization
Source:R/singlesample-lasso-std.R
fit_lasso_std.RdThe lasso-std deployment method applies log2(X_train + 1), drops
constant features, then standardizes each retained feature using its training
mean and sample standard deviation. Five outcome-stratified folds select
lambda.1se, the largest penalty within one standard error of the minimum
cross-validated binomial deviance. The backend uses these standardized
values directly. The stored fit contains the retained features, means,
standard deviations, coefficients (including the intercept) and penalty.
Usage
fit_lasso_std(X_train, y_train, hp = list(), group_train = NULL)Arguments
- X_train
Numeric matrix or data frame of specimens by named features on the abundance scale, with finite values greater than -1. At least two nonconstant features must remain. This function fits directly to those abundances. See
deploy_singlesample()for deployment detection thresholds and raw log-scale inputs.- y_train
Numeric or integer 0/1 outcomes, with 1 for the positive class.
- hp
List with an optional integer
seed(default20261116L). The seed sets the fold assignment and the RNG state before the backend fit.- group_train
Optional group identifiers aligned to rows of
X_train. A group has one outcome and stays in one fold. WithNULL, each row forms its own group.