Title: | Boilerplate Code for 'Tidymodels' Analyses |
---|---|
Description: | Code snippets to fit models using the tidymodels framework can be easily created for a given data set. |
Authors: | Max Kuhn [aut, cre] , Posit Software, PBC [cph, fnd] |
Maintainer: | Max Kuhn <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0.9000 |
Built: | 2024-12-16 03:44:14 UTC |
Source: | https://github.com/tidymodels/usemodels |
These functions make suggestions for code when using a few common models. They print out code to the console that could be considered minimal syntax for their respective techniques. Each creates a prototype recipe and workflow object that can be edited or updated as the data require.
use_glmnet( formula, data, prefix = "glmnet", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_xgboost( formula, data, prefix = "xgboost", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_kknn( formula, data, prefix = "kknn", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_ranger( formula, data, prefix = "ranger", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_earth( formula, data, prefix = "earth", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_cubist( formula, data, prefix = "cubist", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_kernlab_svm_rbf( formula, data, prefix = "kernlab", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_kernlab_svm_poly( formula, data, prefix = "kernlab", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_C5.0( formula, data, prefix = "C50", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_nnet( formula, data, prefix = "nnet", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_rpart( formula, data, prefix = "rpart", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_bag_tree_rpart( formula, data, prefix = "rpart", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_mgcv( formula, data, prefix = "mgcv", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_dbarts( formula, data, prefix = "dbarts", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_mixOmics( formula, data, prefix = "mixOmics", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_xrf( formula, data, prefix = "xrf", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE )
use_glmnet( formula, data, prefix = "glmnet", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_xgboost( formula, data, prefix = "xgboost", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_kknn( formula, data, prefix = "kknn", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_ranger( formula, data, prefix = "ranger", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_earth( formula, data, prefix = "earth", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_cubist( formula, data, prefix = "cubist", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_kernlab_svm_rbf( formula, data, prefix = "kernlab", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_kernlab_svm_poly( formula, data, prefix = "kernlab", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_C5.0( formula, data, prefix = "C50", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_nnet( formula, data, prefix = "nnet", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_rpart( formula, data, prefix = "rpart", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_bag_tree_rpart( formula, data, prefix = "rpart", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_mgcv( formula, data, prefix = "mgcv", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_dbarts( formula, data, prefix = "dbarts", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_mixOmics( formula, data, prefix = "mixOmics", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE ) use_xrf( formula, data, prefix = "xrf", verbose = FALSE, tune = TRUE, colors = TRUE, clipboard = FALSE )
formula |
A simple model formula with no in-line functions. This will be used to template the recipe object as well as determining which outcome and predictor columns will be used. |
data |
A data frame with the columns used in the analysis. |
prefix |
A single character string to use as a prefix for the resulting objects. |
verbose |
A single logical that determined whether comments are added to the printed code explaining why certain lines are used. |
tune |
A single logical that controls if code for model tuning should be printed. |
colors |
A single logical for coloring warnings and code snippets that
require the users attention (ignored when |
clipboard |
A single logical for whether the code output should be sent to the clip board or printed in the console. |
Based on the columns in data
, certain recipe steps printed. For example, if
a model requires that qualitative predictors be converted to numeric (say,
using dummy variables) then an additional step_dummy()
is added. Otherwise
that recipe step is not included in the output.
The syntax is opinionated and should not be considered the exact answer for every data analysis. It has reasonable defaults.
Invisible NULL
but code is printed to the console.
if (rlang::is_installed("modeldata")) { library(modeldata) data(ad_data) use_glmnet(Class ~ ., data = ad_data) data(Sacramento) use_glmnet(price ~ ., data = Sacramento, verbose = TRUE, prefix = "sac_homes") }
if (rlang::is_installed("modeldata")) { library(modeldata) data(ad_data) use_glmnet(Class ~ ., data = ad_data) data(Sacramento) use_glmnet(price ~ ., data = Sacramento, verbose = TRUE, prefix = "sac_homes") }