Hello! I'm working on a project that involves training an LSTM (or GRU) model with time-series data. My data consists of 2 features (strain and deflection) over 5 time steps. I am getting the following error:
Error using trainNetwork: The training sequences are of feature dimension 8 5 but the input layer expects sequences of feature dimension 2.
Here's a breakdown of the data:
- XTrain has dimensions: [8, 5, 2] (8 sequences, 5 time steps, 2 features).
- I'm reshaping the data to [sequenceLength, numFeatures, numSequences] using permute(XTrain, [2, 3, 1]).
- YTrain has dimensions: [8, 2] (8 sequences, 2 output values).
I'm using the following layer configuration:
layers = [ ...
sequenceInputLayer(2) % 2 features: strain and deflection
lstmLayer(100, 'OutputMode', 'last') % LSTM layer
fullyConnectedLayer(2) % Output layer for 2 values: strain and deflection
regressionLayer];
What am I missing? How should I format the input data to make this work with trainNetwork?