# \donttest{
if (torch::torch_is_installed()) {
model_mlp = ffnn(
Species ~ .,
data = iris,
hidden_neurons = c(64, 32),
activations = "relu",
epochs = 100,
verbose = FALSE,
cache_weights = TRUE
)
# Directly use `NeuralNetTools::garson`
model_mlp |>
garson()
# Directly use `NeuralNetTools::olden`
model_mlp |>
olden()
} else {
message("Torch not fully installed — skipping example")
}
# }
# \donttest{
# kindling also supports `vip::vi()` / `vip::vi_model()`
if (torch::torch_is_installed()) {
model_mlp = ffnn(
Species ~ .,
data = iris,
hidden_neurons = c(64, 32),
activations = "relu",
epochs = 100,
verbose = FALSE,
cache_weights = TRUE
)
model_mlp |>
vip::vi(type = 'garson') |>
vip::vip()
} else {
message("Torch not fully installed — skipping example")
}
# }
Run the code above in your browser using DataLab