Time Series and input layer Error

2 次查看(过去 30 天)
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 );

采纳的回答

Divya Gaddipati
Divya Gaddipati 2019-8-5
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 个评论
Kyle Fredin
Kyle Fredin 2019-8-5
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by