This is the list of models tidypredict can parse: 43 fitted model classes from 30 modeling packages.
tidypredict dispatches on the class of the fitted model, so a model is supported if the “Fit with” column covers how it was fitted. Models fitted through parsnip are unwrapped and handed to the same code, so the “parsnip” column is not a separate list of capabilities: it names the spec and engine that produce each fitted class. A blank there means tidypredict has no test for that route, not that it is known to fail.
Regression
| Model | Fit with | parsnip | Details |
|---|---|---|---|
| Linear regression | stats::lm() |
linear_reg(engine = "lm") |
article |
| Generalized linear regression | stats::glm() |
linear_reg(engine = "glm"),
logistic_reg(engine = "glm")
|
article |
| Regularized regression | glmnet::glmnet() |
linear_reg(), logistic_reg(),
multinom_reg() with engine = "glmnet"
|
article |
| Regularized linear models | LiblineaR::LiblineaR() |
logistic_reg(engine = "LiblineaR"),
svm_linear(engine = "LiblineaR")
|
|
| Quantile regression |
quantreg::rq(), quantreg::rqs()
|
linear_reg(engine = "quantreg") |
|
| Multinomial regression | nnet::multinom() |
multinom_reg(engine = "nnet") |
article |
| Support vector machine | kernlab::ksvm() |
svm_linear(engine = "kernlab") |
|
| Neural network | nnet::nnet() |
mlp(engine = "nnet") |
article |
| MARS | earth::earth() |
mars(engine = "earth") |
article |
| Partial least squares |
mixOmics::pls(), spls(),
plsda(), splsda()
|
pls(engine = "mixOmics") |
article |
| Null model | parsnip::nullmodel() |
null_model() |
article |
Classification and discriminant analysis
| Model | Fit with | parsnip | Details |
|---|---|---|---|
| Naive Bayes |
naivebayes::naive_bayes(),
klaR::NaiveBayes()
|
naive_Bayes() with engine = "naivebayes"
or "klaR"
|
article |
| Linear discriminant analysis | MASS::lda() |
discrim_linear(engine = "MASS") |
article |
| Quadratic discriminant analysis | MASS::qda() |
discrim_quad(engine = "MASS") |
article |
| Flexible discriminant analysis | mda::fda() |
discrim_linear(engine = "mda") |
article |
| Shrinkage discriminant analysis | sda::sda() |
discrim_linear(engine = "sda") |
article |
| Regularized discriminant analysis |
sparsediscrim::lda_diag(),
lda_shrink_mean(), lda_shrink_cov(),
lda_emp_bayes_eigen()
|
discrim_linear(engine = "sparsediscrim") |
article |
Trees and forests
| Model | Fit with | parsnip | Details |
|---|---|---|---|
| Decision tree | rpart::rpart() |
decision_tree(engine = "rpart") |
article |
| Decision tree | C50::C5.0() |
decision_tree(engine = "C5.0"),
C5_rules(engine = "C5.0")
|
article |
| Conditional inference tree | partykit::ctree() |
article | |
| Random forest | randomForest::randomForest() |
rand_forest(engine = "randomForest") |
article |
| Random forest | ranger::ranger() |
rand_forest(engine = "ranger") |
article |
| Conditional inference forest | partykit::cforest() |
rand_forest(engine = "partykit") |
article |
| Oblique random forest | aorsf::orsf() |
rand_forest(engine = "aorsf") |
article |
| Bagged trees | baguette::bagger() |
bag_tree() with engine = "rpart" or
"C5.0"
|
article |
| BART | dbarts::bart() |
bart(engine = "dbarts") |
article |
Boosting and rules
| Model | Fit with | parsnip | Details |
|---|---|---|---|
| XGBoost | xgboost::xgb.train() |
boost_tree(engine = "xgboost") |
article |
| LightGBM | lightgbm::lgb.train() |
boost_tree(engine = "lightgbm"), via bonsai |
article |
| CatBoost | catboost::catboost.train() |
boost_tree(engine = "catboost"), via bonsai |
article |
| Boosted C5.0 trees |
C50::C5.0() with trials
|
boost_tree(engine = "C5.0") |
article |
| Model-based boosting | mboost::blackboost() |
||
| Cubist | Cubist::cubist() |
cubist_rules(engine = "Cubist") |
article |
| RuleFit | xrf::xrf() |
rule_fit(engine = "xrf") |
|
| H2O gradient boosting | h2o::h2o.gbm() |
boost_tree(engine = "h2o_gbm"), via agua |
article |
| H2O RuleFit | h2o::h2o.rulefit() |
rule_fit(engine = "h2o"), via agua |
article |
Support vector machines and non-syntactic names
kernlab::ksvm() collects its model matrix with
data.frame(y, x), whose default check.names
runs the column names through make.names(unique = TRUE). A
predictor named a:b is therefore stored as
a.b, and two predictors that mangle to the same name are
told apart with a .1 suffix. The original names are not
recorded anywhere on the fitted object.
On the formula interface there is a terms object to
compare the stored names against, so parse_model() detects
the ambiguity and aborts. On the matrix interface,
ksvm(x, y), there is no terms object, and the
mangling cannot be detected at all: every name make.names()
can produce is also a name it leaves alone, so a stored a.b
is indistinguishable from a model that genuinely had a column named
a.b and is correct. tidypredict_fit()
therefore takes the stored names at face value, and a matrix model
fitted with a non-syntactic column name yields a formula that refers to
a column your data does not have.
Give the matrix columns syntactic names before fitting, or use the formula interface, which will tell you when it cannot recover a name.
Intervals
tidypredict_interval() and
tidypredict_sql_interval() are narrower than
tidypredict_fit(): they only support lm() and
glm() models.
Adding a model
If a model you need is missing, open an
issue. CONTRIBUTING.md describes what a new model
needs, and the non-R models article covers the
other direction: writing a parsed model spec by hand so a model fitted
outside R can be used here.
