r - How to return neural network weights (parameters) values of nnetar function? -
i using nnetar of forecast package forecasting modelling of univariate time series. fitted model example neural network nar(p,p) on series data. want know how can return weighs or best weighs nnetar estimated??
that explained in ?nnetar
: in output, model
field contains list of neural networks fitted data (there several of them).
library(forecast) fit <- nnetar(lynx) str(fit) str(fit$model[[1]]) summary( fit$model[[1]] ) # 8-4-1 network 41 weights # options - linear output units # b->h1 i1->h1 i2->h1 i3->h1 i4->h1 i5->h1 i6->h1 i7->h1 i8->h1 # 2.99 -7.31 3.90 -2.63 -1.48 4.30 2.57 2.77 -9.40 # b->h2 i1->h2 i2->h2 i3->h2 i4->h2 i5->h2 i6->h2 i7->h2 i8->h2 # -0.23 -1.42 -1.27 0.75 2.48 1.12 0.01 -2.79 -2.35 # b->h3 i1->h3 i2->h3 i3->h3 i4->h3 i5->h3 i6->h3 i7->h3 i8->h3 # 3.30 -1.43 -0.79 7.44 -0.42 1.12 -5.36 15.61 -5.17 # b->h4 i1->h4 i2->h4 i3->h4 i4->h4 i5->h4 i6->h4 i7->h4 i8->h4 # 2.49 6.25 -7.01 7.06 -0.99 1.80 -0.55 5.53 -5.31 # b->o h1->o h2->o h3->o h4->o # 2.31 -0.47 -0.16 -4.07 2.37 fit$model[[1]]$wts # [1] 2.98730023 -7.30926809 3.89674784 -2.63077534 -1.48084101 4.30309382 # [7] 2.57150487 2.76947222 -9.40136188 -0.23053466 -1.41876993 -1.26569624 # [13] 0.75035031 2.48057839 1.11969186 0.01107485 -2.79027580 -2.35033702 # [19] 3.29874907 -1.43432740 -0.79437302 7.43590968 -0.42005316 1.12337542 # [25] -5.35698080 15.61077915 -5.16566644 2.49343460 6.25330958 -7.00554826 # [31] 7.05694732 -0.99034344 1.80374167 -0.55078148 5.52887784 -5.31445324 # [37] 2.31407224 -0.46995772 -0.15824823 -4.06939514 2.36781125
Comments
Post a Comment