简体   繁体   English

fable::NNETAR 的变量重要性?

[英]Variable Importance with fable::NNETAR?

Is there a way to get a view of variable importance from a fable::NNETAR model?有没有办法从fable::NNETAR model 中获得可变重要性的视图? Something like the little made-up nnet example below?像下面这个虚构的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

Created on 2019-09-18 by the reprex package (v0.3.0)reprex package (v0.3.0) 于 2019 年 9 月 18 日创建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM