Error with SequenceInputLayer - TrainNetwork Expects Sequence Dimensions
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 AI for Signals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!