是否有一种方法可以从fable::NNETAR
模型中获得可变重要性的视图?像下面的小编nnet
示例一样?
library(tidyverse)
library(fable)
#> Loading required package: fabletools
library(NeuralNetTools)
library(nnet)
ts <- tibble(index = 1:1000) %>%
mutate(
y = seq(0.5, 1000 / 2, by = 0.5) + arima.sim(model = list(
ar = c(0.2, 0.3),
ma = 0.2,
order = c(2, 1, 1)
), 999) %>% as.double(),
x1 = seq(0.5, 1000 / 2, by = 0.5),
x2 = 1:1000,
x3 = 1
) %>%
as_tsibble(index = index)
# Possible to extract variable importance from fable::NNETAR ...
mod <- ts %>%
model(NNet = NNETAR(y ~ x1 + x2 + x3))
#> Warning: Constant xreg column, setting `scale_inputs=FALSE`
# ... as per the nnet / garson example?
nnet(y ~ x1 + x2 + x3, data = ts, size = 1) %>%
garson() +
ggtitle("NN Variable Importance")
#> # weights: 6
#> initial value 53799287.386267
#> final value 53627119.744357
#> converged
由reprex package(v0.3.0)于2019-09-18创建