-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Is there a tutorial of using mxnet R LSTM for time series forecasting? #7524
Comments
There's a pull request #7476 meant to facilitate training of various flavours of RNN and support iterators feeding various sequence lengths. Current design is more adapted to text as it assumes that data feed is of dimension : seq.length X batch.size, to which embedding is applied. If you take a look at the demo of the new functionalities here, you can see that it would be quite simple to adapt the model graph by omitting the embedding operator and instead have an iterator that feed data of shape features.number X batch.size X sequence.length. By working with the mx.symbol.RNN operator, the modeling approach is essentially the same as for the feedforwardmode: just need to build the symbol graph, for which the Your feedback on whether you think these functionalities would be helpful are most welcome. |
Unfortunately, poor documentation of mxnetR library is causing a lot of trouble to many developers. After spending a lot of time to understand the API it is known only through list of open issues that current LSTM functionality is only for textual data (#7446) . A simple line in documentation description would save days! |
The refactor RNN API has now been merged and the demo on its usage updated.
Agree for the need on improved documentation of the package. Suggestions welcome! |
It would still be very helpful to have a tutorial on a simple time-series modelling with MXNET in R. |
As a starting point you can take a look at this rough demo for an LSTM on a sin waves: https://github.com/jeremiedb/mxnet_R_bucketing/blob/master/TimeSeries.md. I think it would be better to switch the assumed data structure to features X seq_length X batch_size despite the RNN symbol format since CSV and arrayiter are all assuming that batches are on the last dimension, I'll try to have this fix rapidly. |
Looking at time series tutorial and using same code, the following error is being thrown: Error in mx.varg.symbol.FullyConnected(list(...)) :
|
The code needs to be run on 0.12 or higher, flatten option wasn't present prior. If not possible to upgrade, you can simply remove the flatten option in the graph and add a flatten operator (if the default FC behavior isn't to flatten). |
Ahh gotcha, thanks a lot! |
@jeremiedb |
Sorry about that, did some updates on the examples. These should be cleaner: https://jeremiedb.github.io/mxnet_R_bucketing/TimeSeries_CPU |
@jeremiedb : |
Thanks for pointing this out. I took a second look and I believe the code is correct. There hasn't been an extensive parameter tuning of the model and making predictions on a long future horizon can easily result in errors build up (during training, the previous real label is provided). |
@jeremiedb , I will try to run the code myself. If I will understand where the source of bad modelling is I will post here. Thank you! |
@jeremiedb, hello. I got some time to try your LSTM code. Could you please advise whuch R mxnet version I must get on my Windows PC to run this code? I cannot locate the rnn.graph.unroll functions in my current version (0.10.1). |
Hello, it should be > 1.0. There's unfortunately no such version pre-package right now and OpenCV gave me issues building on Windows. |
@lichen11 @nswamy @sandeep-krishnamurthy Could you please close this issue as the example has been merged. |
Can you provide some examples of using mxnet R for (multivariate) time series forecasting? I found this resource https://www.r-bloggers.com/recurrent-models-and-examples-with-mxnetr/. But it is predicting text data. I would like to know how to do it on numeric data. Are you also planning to develop some high-level API for time series forecasting using LSTM?
The text was updated successfully, but these errors were encountered: