0
$\begingroup$

I am using nnetar package for time series forecasting in R.But each time when I run the model, I am getting different output. i guess this is related to different random weight initialization at each time, but I don't know how to set it as constant.

ts=nnetar(Time_Series,P=3,lambda = 0,decay=0.001,maxit=150)
fs = forecast(ts, h=12)

Any pointers would be appreciated.

$\endgroup$

1 Answer 1

2
$\begingroup$

Just set the random seed before you call nnetar and you will get the same random initialization each time.

set.seed(12345)
ts=nnetar(Time_Series,P=3,lambda = 0,decay=0.001,maxit=150)
fs = forecast(ts, h=12)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.