Skip to content

tabby provides parsnip interfaces for tabular deep learning models. Within tidymodels, they follow the same fit() and predict() flow as any other model. This means you can do things like tune and resample them right alongside the rest of your workflow. tabby supplies only the interface, and the fitting happens in engine packages you install separately, namely brulee and tabpfn. All supported models run on Torch.

Two of the supported models ask a little more of your setup. TabPFN and Chronos-2 are pretrained, so they download their weights the first time you use them, and TabPFN also needs a Python environment, created via reticulate. Being pretrained, they also have few or no hyperparameters to tune, whereas the other supported models carry the usual knobs to optimize.

Supported models

Model Function Mode Engine Python
TabPFN tabular_pfn() classification, regression tabpfn
TabICL tabular_icl() classification, regression brulee
ResNet tabular_resnet() classification, regression brulee
SAINT tabular_saint() classification, regression brulee
AutoInt tabular_auto_int() classification, regression brulee
Regularization Learning Network tabular_rln() regression brulee
Chronos-2 (forecasting) tabular_chronos() quantile regression, regression brulee

Installation

You can install the development version of tabby from GitHub with:

# install.packages("pak")
pak::pak("tidymodels/tabby")

Example

Create a model specification the same way you would for any parsnip model. Here is a ResNet for classification:

library(tabby)
#> Loading required package: parsnip

resnet_spec <-
  tabular_resnet(
    mode = "classification",
    hidden_units = 32L,
    epochs = 100L,
    penalty = 0.01
  )

resnet_spec
#> tabular resnet Model Specification (classification)
#> 
#> Main Arguments:
#>   hidden_units = 32
#>   penalty = 0.01
#>   epochs = 100
#> 
#> Computational engine: brulee

Fit and predict as usual:

resnet_fit <- fit(resnet_spec, class ~ ., data = train_data)
predict(resnet_fit, new_data = test_data)

Mark any argument with tune() to optimize it with the tune package.

Tuning grids for layered networks

Some models take per-layer parameters, such as a vector of hidden units with one entry per layer. tabby provides helpers to build space-filling grids over these list-valued parameters:

rn_spec <-
  tabular_resnet(
    hidden_units = tune(),
    bottleneck_units = tune(),
    penalty = tune()
  )

rn_grid <- neural_net_grid_space_filling(rn_spec)
rn_grid |> expand_list_parameters()

Code of Conduct

Please note that the tabby project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.