feature_selection_lasso: Feature selection by lasso

View source: R/trans_feature_selection_lasso.R

feature_selection_lassoR Documentation

Feature selection by lasso

Description

Selects predictors using L1-regularized regression.

Usage

feature_selection_lasso(attribute, features = NULL)

Arguments

attribute

target attribute name

features

optional vector of feature names (default: all numeric columns except attribute)

Details

Fits a lasso path with glmnet and keeps predictors with non-zero coefficients at lambda.min. The target attribute must be numeric.

Value

returns an object of class feature_selection_lasso

References

Tibshirani, R. (1996). Regression Shrinkage and Selection via the Lasso. Journal of the Royal Statistical Society, Series B, 58(1):267-288. Friedman, J., Hastie, T. and Tibshirani, R. (2010). Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of Statistical Software, 33(1):1-22.

Examples

if (requireNamespace("glmnet", quietly = TRUE)) {
 data(Boston)
 fs <- feature_selection_lasso("medv")
 fs <- fit(fs, Boston)
 fs$selected
 boston_fs <- transform(fs, Boston)
 names(boston_fs)
}

daltoolbox documentation built on Nov. 23, 2026, 9:08 a.m.