---
title: "Supported Models and recipes steps"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Supported Models and recipes steps}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

The supported methods currently all come from [tidypredict](https://tidypredict.tidymodels.org/) right now.

## Supported models

This table doesn't exhaustively list fully unsupported models. Please file [an issue](https://github.com/tidymodels/orbital/issues) to add model to table.

```{r}
#| echo: false
#| message: false
if (!rlang::is_installed(c("gt", "tibble"))) {
  knitr::knit_exit()
}
```

```{r}
#| echo: false
#| message: false
#| error: false
#| output: false
library(gt)
library(dplyr)

tibble::tribble(
  ~parsnip,               ~engine,              ~numeric, ~class, ~prob,
  "`boost_tree()`",       "`\"xgboost\"`",      "✅",     "✅",    "✅",
  "`cubist_rules()`",     "`\"Cubist\"`",       "✅",     "❌",    "❌",
  "`decision_tree()`",    "`\"partykit\"`",     "✅",     "✅",    "✅",
  "`linear_reg()`",       "`\"lm\"`",           "✅",     "❌",    "❌",
  "`linear_reg()`",       "`\"glmnet\"`",       "⚪",     "❌",    "❌",
  "`logistic_reg()`",     "`\"glm\"`",          "❌",     "✅",    "✅",
  "`logistic_reg()`",     "`\"glmnet\"`",       "❌",     "⚪",    "⚪",
  "`mars()`",             "`\"earth\"`",        "✅",     "⚪",    "⚪",
  "`naive_Bayes()`",      "`\"naivebayes\"`",   "❌",     "⚪",    "⚪",
  "`nearest_neighbor()`", "`any`",              "❌",     "❌",    "❌", 
  "`rand_forest()`",      "`\"randomForest\"`", "✅",     "⚪",    "⚪",
  "`rand_forest()`",      "`\"ranger\"`",       "✅",     "⚪",    "⚪"
) |>
  gt() |>
  tab_spanner(
    label = "Model",
    columns = c(parsnip, engine)
  ) |>
  tab_spanner(
    label = "Regression",
    columns = c(numeric)
  ) |>
  tab_spanner(
    label = "Classification",
    columns = c(class, prob)
  ) |>
  tab_header(
    title = "Supported Prediction Types"
  ) |>
  cols_align(
    "center",
    columns = c(numeric, class, prob)
  ) |>
  tab_footnote("✅: Supported") |>
  tab_footnote("❌: Cannot be supported") |>
  tab_footnote("⚪: Not yet supported") |>
  fmt_markdown(
    columns = c(parsnip, engine)
  )
```

Creating orbital objects of **ranger** models takes around 1 second per tree. This is in part because the resulting SQL is quite large, making it hard to use on many platforms unless care is taken with regard to hyperparameters and the data.

## Recipes steps

```{r}
#| include: false
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r}
#| label: setup
#| echo: false
library(orbital)
```

```{r}
#| echo: false
all_funs <- ls(getNamespace("orbital"))

steps <- grep("orbital.step_", all_funs, value = TRUE)
steps <- gsub("orbital.", "", steps)
```

The following `r length(steps)` recipes steps are supported

```{r}
#| results: asis
#| echo: false
cat(paste0("- `", steps, "()`\n"))
```
