knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The goal of bolasso is to apply robust feature selection via lasso and bootsrtapping.
You can install bolasso from github with:
# install.packages("devtools") devtools::install_github("david26694/bolasso")
This is a basic example which shows you how to apply bolasso in a regression setting:
## basic example code library(bolasso) # We want to predict vs with the other mtcars variables predictors <- mtcars[,c("mpg", "disp", "hp", "drat", "wt")] outcome <- mtcars[, "vs"] # Apply bolasso with 10 bootstrap samples model <- bolasso(predictors, outcome, n_bootstraps = 10) # Show variable selection results summary(model) # It can also run on recipes, and with formulas library(recipes) rec <- recipe(mpg ~ ., mtcars) rec <- step_log(rec, disp) model_rec <- bolasso(rec, mtcars, n_bootstraps = 20) summary(model_rec) # It has different types of prediction, like numeric, class and prob predict(model_rec, mtcars, type = 'numeric')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.