--- title: "Supported models" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Supported models} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- 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](https://parsnip.tidymodels.org/) 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](lm.html) | | Generalized linear regression | `stats::glm()` | `linear_reg(engine = "glm")`, `logistic_reg(engine = "glm")` | [article](glm.html) | | Regularized regression | `glmnet::glmnet()` | `linear_reg()`, `logistic_reg()`, `multinom_reg()` with `engine = "glmnet"` | [article](glmnet.html) | | 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](multinom.html) | | Support vector machine | `kernlab::ksvm()` | `svm_linear(engine = "kernlab")` | | | Neural network | `nnet::nnet()` | `mlp(engine = "nnet")` | [article](nnet.html) | | MARS | `earth::earth()` | `mars(engine = "earth")` | [article](mars.html) | | Partial least squares | `mixOmics::pls()`, `spls()`, `plsda()`, `splsda()` | `pls(engine = "mixOmics")` | [article](mixOmics.html) | | Null model | `parsnip::nullmodel()` | `null_model()` | [article](nullmodel.html) | ## Classification and discriminant analysis | Model | Fit with | parsnip | Details | |---|---|---|---| | Naive Bayes | `naivebayes::naive_bayes()`, `klaR::NaiveBayes()` | `naive_Bayes()` with `engine = "naivebayes"` or `"klaR"` | [article](naivebayes.html) | | Linear discriminant analysis | `MASS::lda()` | `discrim_linear(engine = "MASS")` | [article](lda.html) | | Quadratic discriminant analysis | `MASS::qda()` | `discrim_quad(engine = "MASS")` | [article](qda.html) | | Flexible discriminant analysis | `mda::fda()` | `discrim_linear(engine = "mda")` | [article](fda.html) | | Shrinkage discriminant analysis | `sda::sda()` | `discrim_linear(engine = "sda")` | [article](sda.html) | | Regularized discriminant analysis | `sparsediscrim::lda_diag()`, `lda_shrink_mean()`, `lda_shrink_cov()`, `lda_emp_bayes_eigen()` | `discrim_linear(engine = "sparsediscrim")` | [article](sparsediscrim.html) | ## Trees and forests | Model | Fit with | parsnip | Details | |---|---|---|---| | Decision tree | `rpart::rpart()` | `decision_tree(engine = "rpart")` | [article](rpart.html) | | Decision tree | `C50::C5.0()` | `decision_tree(engine = "C5.0")`, `C5_rules(engine = "C5.0")` | [article](C5.0.html) | | Conditional inference tree | `partykit::ctree()` | | [article](partykit.html) | | Random forest | `randomForest::randomForest()` | `rand_forest(engine = "randomForest")` | [article](rf.html) | | Random forest | `ranger::ranger()` | `rand_forest(engine = "ranger")` | [article](ranger.html) | | Conditional inference forest | `partykit::cforest()` | `rand_forest(engine = "partykit")` | [article](partykit.html) | | Oblique random forest | `aorsf::orsf()` | `rand_forest(engine = "aorsf")` | [article](aorsf.html) | | Bagged trees | `baguette::bagger()` | `bag_tree()` with `engine = "rpart"` or `"C5.0"` | [article](bagging.html) | | BART | `dbarts::bart()` | `bart(engine = "dbarts")` | [article](bart.html) | ## Boosting and rules | Model | Fit with | parsnip | Details | |---|---|---|---| | XGBoost | `xgboost::xgb.train()` | `boost_tree(engine = "xgboost")` | [article](xgboost.html) | | LightGBM | `lightgbm::lgb.train()` | `boost_tree(engine = "lightgbm")`, via bonsai | [article](lightgbm.html) | | CatBoost | `catboost::catboost.train()` | `boost_tree(engine = "catboost")`, via bonsai | | | Boosted C5.0 trees | `C50::C5.0()` with `trials` | `boost_tree(engine = "C5.0")` | [article](C5.0.html) | | Model-based boosting | `mboost::blackboost()` | | | | Cubist | `Cubist::cubist()` | `cubist_rules(engine = "Cubist")` | [article](cubist.html) | | RuleFit | `xrf::xrf()` | `rule_fit(engine = "xrf")` | | | H2O gradient boosting | `h2o::h2o.gbm()` | `boost_tree(engine = "h2o_gbm")`, via agua | [article](h2o.html) | | H2O RuleFit | `h2o::h2o.rulefit()` | `rule_fit(engine = "h2o")`, via agua | [article](h2o.html) | ## 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](https://github.com/tidymodels/tidypredict/issues). `CONTRIBUTING.md` describes what a new model needs, and the [non-R models](non-r.html) article covers the other direction: writing a parsed model spec by hand so a model fitted outside R can be used here.