diff --git a/docs/dev/articles/articles/Classification.html b/docs/dev/articles/articles/Classification.html index b0c493db9..20a8780b1 100644 --- a/docs/dev/articles/articles/Classification.html +++ b/docs/dev/articles/articles/Classification.html @@ -153,7 +153,7 @@

Classification Example

nnet_fit #> parsnip model object #> -#> Fit in: 15.1sModel +#> Fit in: 15.3sModel #> ________________________________________________________________________________ #> Layer (type) Output Shape Param # #> ================================================================================ @@ -190,12 +190,12 @@

Classification Example

#> # A tibble: 1 x 3 #> .metric .estimator .estimate #> <chr> <chr> <dbl> -#> 1 accuracy binary 0.807 +#> 1 accuracy binary 0.801 test_results %>% conf_mat(truth = Status, nnet_class) #> Truth #> Prediction bad good -#> bad 188 90 -#> good 125 710 +#> bad 188 96 +#> good 125 704 diff --git a/docs/dev/articles/articles/Regression.html b/docs/dev/articles/articles/Regression.html index 30a3443a4..6fcae7af4 100644 --- a/docs/dev/articles/articles/Regression.html +++ b/docs/dev/articles/articles/Regression.html @@ -155,7 +155,7 @@

rf_xy_fit #> parsnip model object #> -#> Fit in: 951msRanger result +#> Fit in: 971msRanger result #> #> Call: #> ranger::ranger(formula = formula, data = data, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) @@ -269,7 +269,7 @@

) #> parsnip model object #> -#> Fit in: 3.6sRanger result +#> Fit in: 3.7sRanger result #> #> Call: #> ranger::ranger(formula = formula, data = data, mtry = ~.preds(), num.trees = ~1000, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) diff --git a/docs/dev/articles/articles/Scratch.html b/docs/dev/articles/articles/Scratch.html index 82de12044..31edc69b9 100644 --- a/docs/dev/articles/articles/Scratch.html +++ b/docs/dev/articles/articles/Scratch.html @@ -378,7 +378,7 @@

mda_fit #> parsnip model object #> -#> Fit in: 21msCall: +#> Fit in: 18msCall: #> mda::mda(formula = formula, data = data, subclasses = ~2) #> #> Dimension: 4 diff --git a/docs/dev/reference/fit.html b/docs/dev/reference/fit.html index 5cf04f8b8..233009a59 100644 --- a/docs/dev/reference/fit.html +++ b/docs/dev/reference/fit.html @@ -266,7 +266,7 @@

Examp #> Null Deviance: 4055 #> Residual Deviance: 3698 AIC: 3704
using_xy
#> parsnip model object #> -#> Fit in: 21ms +#> Fit in: 18ms #> Call: stats::glm(formula = formula, family = stats::binomial, data = data) #> #> Coefficients: diff --git a/vignettes/articles/Models.Rmd b/vignettes/articles/Models.Rmd index 653893c72..be1fd9e77 100644 --- a/vignettes/articles/Models.Rmd +++ b/vignettes/articles/Models.Rmd @@ -17,6 +17,7 @@ knitr::opts_chunk$set( ) options(digits = 3) library(parsnip) +library(discrim) library(tidymodels) library(cli) library(kableExtra) @@ -24,9 +25,12 @@ library(kableExtra) `parsnip` contains wrappers for a number of models. For example, the `parsnip` function `rand_forest()` can be used to create a random forest model. The **mode** of a model is related to its goal. Examples would be regression and classification. -The list of models accessible via `parsnip` is: +Since there are many models available in R, there are also "side packages" that wrap groups of models: -```{r model-table, results = 'asis', echo = FALSE} + * [`discrim`](https://github.com/tidymodels/discrim) contains discriminant analysis models. + + +```{r model-table, include = FALSE} mod_names <- get_from_env("models") mod_list <- @@ -36,19 +40,38 @@ mod_list <- arrange(mode, model) %>% group_by(mode) %>% summarize(models = paste(model, collapse = ", ")) +``` + +_How_ the model is created is related to the **engine**. In many cases, this is an R modeling package. In others, it may be a connection to an external system (such as Spark or Tensorflow). The tables below list the engines for each model type along with the type of prediction that it can make (see `predict.model_fit()`). + +Models can be added by the user too. See the ["Making a {parsnip} model from scratch" vignette](Scratch.html). -for (i in 1:nrow(mod_list)) { - cat(mod_list[["mode"]][i], ": ", - mod_list[["models"]][i], "\n\n\n", - sep = "") -} +The list of models accessible via `parsnip` and `discrim` are listed below: + + +## Classification Models + +```{r class-table, results = 'asis', echo = FALSE} +map_dfr(mod_names, ~ get_from_env(paste0(.x, "_predict")) %>% mutate(model = .x)) %>% + dplyr::filter(mode == "classification") %>% + dplyr::select(model, engine, type) %>% + mutate( + type = paste0("`", type, "`"), + model = paste0("`", model, "()`"), + ) %>% + mutate(check = cli::symbol$tick) %>% + spread(type, check, fill = cli::symbol$times) %>% + kable(format = "html") %>% + kable_styling(full_width = FALSE) %>% + collapse_rows(columns = 1) ``` -_How_ the model is created is related to the _engine_. In many cases, this is an R modeling package. In others, it may be a connection to an external system (such as Spark or Tensorflow). This table lists the engines for each model type along with the type of prediction that it can make (see `predict.model_fit()`). +## Regression Models ```{r pred-table, results = 'asis', echo = FALSE} map_dfr(mod_names, ~ get_from_env(paste0(.x, "_predict")) %>% mutate(model = .x)) %>% - dplyr::select(-value) %>% + dplyr::filter(mode == "regression") %>% + dplyr::select(model, engine, type) %>% mutate( type = paste0("`", type, "`"), model = paste0("`", model, "()`"), @@ -60,5 +83,6 @@ map_dfr(mod_names, ~ get_from_env(paste0(.x, "_predict")) %>% mutate(model = .x) collapse_rows(columns = 1) ``` -Models can be added by the user too. See the ["Making a `parsnip` model from scratch" vignette](Scratch.html). + +