Add LSTM and SFM to Pymc

In the time series prediction, both lstm and sfm have good performance. I don’t know if pymc can consider adding these two time-predicted models to the framework.

1 Like

In the process of studying stock forecasting, I generated a lot of useful models based on sfm, and I think that lstm’s architecture has a lot of room for improvement. Pymc’s time series forecasting method should contain two methods.I want to implement this idea in GSoC 2019. The model code for sfm is here (https://github.com/z331565360/State-Frequency-Memory-stock-prediction), and interestingly this code is also based on theano.

It depends on how you want to go about to use it, I see there are 2 possible ways, both are a bit challenging:

  • Set up LSTM or SFM neural net as an approximation for autoencoding variational Bayes, similar idea: https://docs.pymc.io/notebooks/lda-advi-aevb.html. The challenge is to make sure the parameter clone is performed correctly, and you need a good logp function for the observed with the LSTM or SFM parameters are input.
  • Use LSTM or SFM layer in a PyMC3 model. The challenge here is that Keras recurrent layer might not work out of the box, and inference could be extremely difficult.
1 Like

Thank you very much for your reply, and I have benefited from the questions you have raised. I can use theano to implement lstm and sfm, and do not need to use keras. The sfm is actually a lstm process with the addition of Fourier transform. But how to include the API and how it works in pymc3 is really worth pondering. I will continue to study, I will inform you if there is any progress.