| kindling-varimp | R Documentation |
This file implements methods for variable importance generics from NeuralNetTools and vip packages.
## S3 method for class 'ffnn_fit'
garson(mod_in, bar_plot = FALSE, ...)
## S3 method for class 'ffnn_fit'
olden(mod_in, bar_plot = TRUE, ...)
## S3 method for class 'ffnn_fit'
vi_model(object, type = c("olden", "garson"), ...)
mod_in |
A fitted model object of class "ffnn_fit". |
bar_plot |
Logical. Whether to plot variable importance (default TRUE). |
... |
Additional arguments passed to methods. |
object |
A fitted model object of class "ffnn_fit". |
type |
Type of algorithm to extract the variable importance. This must be one of the strings:
|
A data frame for both "garson" and "olden" classes with columns:
x_names |
Character vector of predictor variable names |
y_names |
Character string of response variable name |
rel_imp |
Numeric vector of relative importance scores (percentage) |
The data frame is sorted by importance in descending order.
A tibble with columns "Variable" and "Importance"
(via vip::vi() / vip::vi_model() only).
{kindling} inherits NeuralNetTools::garson to extract the variable
importance from the fitted ffnn() model.
{kindling} inherits NeuralNetTools::olden to extract the variable
importance from the fitted ffnn() model.
{vip} PackageYou can directly use vip::vi() and vip::vi_model() to extract the variable
importance from the fitted ffnn() model.
Beck, M.W. 2018. NeuralNetTools: Visualization and Analysis Tools for Neural Networks. Journal of Statistical Software. 85(11):1-20.
Garson, G.D. 1991. Interpreting neural network connection weights. Artificial Intelligence Expert. 6(4):46-51.
Goh, A.T.C. 1995. Back-propagation neural networks for modeling complex systems. Artificial Intelligence in Engineering. 9(3):143-151.
Olden, J.D., Jackson, D.A. 2002. Illuminating the 'black-box': a randomization approach for understanding variable contributions in artificial neural networks. Ecological Modelling. 154:135-150.
Olden, J.D., Joy, M.K., Death, R.G. 2004. An accurate comparison of methods for quantifying variable importance in artificial neural networks using simulated data. Ecological Modelling. 178:389-397.
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")
}
# 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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.