LSTM and Transformer Implementation

Course Name: Deep Reinforcement Learning in Trading, Section No: 17, Unit No: 1, Unit type: Notebook

Hi team, 

I was wondering if you could please provide the code for LSTM and Transformer Attention network implementation of backtest. At the moment DRL uses ANN (Conv) as its engine, but I would like to implement both LSTM and Transformer as engines for DRL. Sadly, I have failed to do so for over 3 days due to problems with dimensions, etc. Thanks a lot

Hi Israel,



We have forwarded your query to the course author. We will get back to you as soon as we receive a reply. 

Hi Israel,



We have received the following reply from Dr Thomas Starke:

We provide a basic implementation for the DRL. However since this is a course for study, we leave it to the students to implement their own improvements, of which there are nearly infinite permutations. In order to introduce LSTMs, one simply hast to stack the inputs in a 3D lagged matrix and  modify the layers to get the desired network type. Some attention has to be paid to the way the dimensionality of the input is structured. I recommend building a an input wrapper to convert the matrix to 3D initially using a toy model to avoid confusion around dimensionality. 

Hope this helps!