Building an LSTM Regression Model with Sliding Windows

11 次查看(过去 30 天)
Hi everyone,
I'm working on a regression problem (not forecasting) using LSTM in MATLAB, and I could really use some guidance. Here’s the setup of my project:
Data Overview:
  • I have three datasets stored in CSV files.
  • The inputs are in columns 3 and 6.
  • The output (target) is in column 8.
Sliding Window Setup:
  • I want to group the input data into sliding windows of size 15.
  • For example, rows 1–15 will correspond to the output at row 16, rows 2–16 to the output at row 17, and so on.
Train-Test Split:
  • I plan to use datasets 1 and 2 for training.
  • Dataset 3 will be used for testing.
Objective:
  • Train an LSTM model that can predict the target values for the test dataset based on the inputs in columns 3 and 6 with the defined window size.
Questions:
  1. How can I efficiently implement the sliding window for inputs and outputs in MATLAB?
  2. What is the best way to prepare XTrain, YTrain, XTest, and YTest in a cell array format that MATLAB's LSTM accepts?
  3. Any tips on how to structure the LSTM for this kind of regression task?
  4. How do I configure the LSTM to ensure it doesn’t use predicted outputs as inputs for subsequent predictions?
Any example code snippets, references, or advice would be highly appreciated!
Thanks in advance for your help!

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by