usemodels 0.2.0

  tidymodels

  Max Kuhn

We’re chuffed to announce the release of usemodels 0.2.0. The usemodels package enables users to generate tidymodels code for fitting and tuning models. Given a) a formula and b) a data set, the use_*() functions (such as use_glmnet() and use_xgboost()) create code to fit that specific model to that data, including appropriate preprocessing.

You can install it from CRAN with:

install.packages("usemodels")

This blog post describes some new features. You can see a full list of changes in the release notes.

library(usemodels)

Clipboard access

Each of the use_*() functions now has a clipboard feature that will send the new code to the clipboard, instead of writing to the console window.

use_cubist(mpg ~ ., data = mtcars, clipboard = TRUE)
## ✓ code is on the clipboard.

New models

As requested in GitHub issues, support for C5.0 and SVM models was added. SVM models require centering and scaling of the predictors, so the usemodel function provides this automatically:

data(two_class_dat, package = "modeldata")
use_kernlab_svm_rbf(Class ~ ., data = two_class_dat)
## kernlab_recipe <- 
##   recipe(formula = Class ~ ., data = two_class_dat) %>% 
##   step_zv(all_predictors()) %>% 
##   step_normalize(all_numeric_predictors()) 
## 
## kernlab_spec <- 
##   svm_rbf(cost = tune(), rbf_sigma = tune()) %>% 
##   set_mode("classification") 
## 
## kernlab_workflow <- 
##   workflow() %>% 
##   add_recipe(kernlab_recipe) %>% 
##   add_model(kernlab_spec) 
## 
## set.seed(81161)
## kernlab_tune <-
##   tune_grid(kernlab_workflow, resamples = stop("add your rsample object"), grid = stop("add number of candidate points"))

Let us know if there are other features that would be interesting for the package on its GitHub issues page.

Acknowledgements

Thanks to all the people who contributed to usemodels since our last blog post: @amazongodman, @brshallo, @bryceroney, @czeildi, @EmilHvitfeldt, @hfrick, @jennybc, @juliasilge, @larry77, and @topepo.