awslabs / gluonts

Probabilistic time series modeling in Python
https://ts.gluon.ai
Apache License 2.0
4.56k stars 749 forks source link

Reproducibility of results from RForecastPredictor #1360

Open shruti32 opened 3 years ago

shruti32 commented 3 years ago

Hi Team,

I am using RForecastPredictor module of the GluonTS package. I am not able to reproduce the same result every time when I run the module on the same time series. I set the seed using the below two lines of code: np.random.seed(0) mx.random.seed(0) "mx is short for mxnet". These 2 lines of code seem to work for Prophet module of GluonTS but not for RForecastPredictor Let me know if something else is needed from my side to reproduce the issue.

Regards Shruti

jaheba commented 3 years ago

Hello @shruti32,

you would need to set the seed in R as well. The reason why your approach doesn't work is that you set the seed for things outside of the runtime, but non within it. I'm no expert in R, but according to this SO post [1] you would need to run set.seed(...) in the R-code (This would require changing the code).

[1] https://stackoverflow.com/questions/43101157/r-neural-network-forecasting-aspect-of-randomness