{kindling} bridges the gap between {torch}
and {tidymodels}, providing a streamlined interface for
building, training, and tuning deep learning models. This vignette will
guide you through the basic usage.
{kindling} offers flexibility through four levels of
abstraction:
torch::nn_module codeparsnip, recipes, and
workflowstune and dialsGenerate PyTorch-style module code:
Train a model with one function call:
Work with neural networks like any other parsnip
model:
box::use(
parsnip[fit, augment],
yardstick[metrics]
)
nn_spec = mlp_kindling(
mode = "classification",
hidden_neurons = c(10, 7),
activations = act_funs(relu, softshrink = args(lambd = 0.5)),
epochs = 100
)
nn_fit = fit(nn_spec, Species ~ ., data = iris)
augment(nn_fit, new_data = iris) |>
metrics(truth = Species, estimate = .pred_class)