- Data Preparation: Prepare the training data to include the distance travelled alongside the spectral evolution data. Each input sample should consist of the spectral evolution at a particular distance and the corresponding distance travelled.
- Update Model Inputs: Modify the input layer of your RNN to accept both the spectral evolution and the distance travelled as inputs at each step. This can be achieved by concatenating both the data for each step.
- Training: During training, use the concept of teacher forcing. At each step of the training sequence, provide the spectral evolution data and the corresponding distance travelled as inputs to the network. This allows the network to learn the relationship between the spectral evolution and the distance travelled.
- Prediction: When making predictions using the trained RNN, provide the spectral evolution at the current distance travelled as the initial input. Then, at each subsequent step, provide the predicted spectral evolution from the previous step and the corresponding distance travelled as inputs to predict the next spectral evolution.
LSTM RNN predictions dependant on more variables?
2 views (last 30 days)
Show older comments
I have built a RNN with a LSTM layer to predict a spectral evolution (i.e. each step is a wavelengh vs. energy plot). The it works fine but it is not dependent on the distance propagated. My question is this: how can my neural network, at each step of the prediction, take another input other than the previous step, which in my case would be the distance travelled? Obviously I would have to include it in the training as well. As far as I can tell I can only predict the next array from the previous one. Could anyone help? Thanks
0 Comments
Answers (1)
Ayush Anand
on 21 Nov 2023
Hi Simone,
I understand you have a RNN model with an LSTM layer and you want to incorporate the distance travelled as an input at every step along with the output from the previous layer. You can do this using the concept of “Teacher Forcing”. Teacher forcing allows you to provide additional input at each step of the prediction, such as the distance travelled, while still training the network to predict the next spectral evolution based on the previous step.
Here's a high-level approach to incorporate the distance travelled as an input to your RNN:
You can refer to the following answer for reading more on how to implement the concept of Teacher Forcing in MATLAB:
I hope this helps!
0 Comments
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!