View source: R/trans_feature_selection_lasso.R
| feature_selection_lasso | R Documentation |
Selects predictors using L1-regularized regression.
feature_selection_lasso(attribute, features = NULL)
attribute |
target attribute name |
features |
optional vector of feature names (default: all numeric columns except |
Fits a lasso path with glmnet and keeps predictors with non-zero coefficients at lambda.min.
The target attribute must be numeric.
returns an object of class feature_selection_lasso
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.