Time Series and input layer Error

1 view (last 30 days)
XTrain = dataTrainStandardized(1:end-1);
YTrain = dataTrainStandardized(2:end);
numFeatures = 1;
numResponses = 1;
numHiddenUnits = 200;
layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits)
fullyConnectedLayer(numResponses)
regressionLayer];
options = trainingOptions('adam', ...
'MaxEpochs',250, ...
'GradientThreshold',1, ...
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',125, ...
'LearnRateDropFactor',0.2, ...
'Verbose',0, ...
'Plots','training-progress');
net = trainNetwork(XTrain,YTrain,layers,options);
net = trainNetwork(XTrain,YTrain,layers,options); >>>> ***Error using trainNetwork (The training sequence are of feature dimention 5353 but the input layer expects sequences of feature dimention 1).
I'm trying to work a collegues code from a previous MLab version. Since I'm using R2019a, is there an issue with the DAGNetwork because it's crashing at "iThrowCNNException( e );

Accepted Answer

Divya Gaddipati
Divya Gaddipati on 5 Aug 2019
From the error you received, I can see that your input data is of size 5353.
But, from line 3 of your code, you are defining the input size (numFeatures) of your sequenceInputLayer as 1, whereas it should be defined as 5353.
  1 Comment
Kyle Fredin
Kyle Fredin on 5 Aug 2019
Thank you, Divya.
What I ended up doing, and it may not be the best coding practice, was to execute a rot90(data) earlier up in the code after the data ingest. This did the trick. It comes in at 5335x1 and the training structure was appearently looking for 1x5335.
Still not sure how this fully operates yet. Still some learning to do. Thx again for you time.

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!