回帰用のLSTMネットワークで、sequence-to-oneの回帰学習を行う際に、エラーになってしまいます。
Show older comments
回帰用のLSTMネットワークで、sequence-to-oneの回帰学習を行いたく、下記のようなlayerを作りました。
layers = [ ...
sequenceInputLayer(featureDimension)
lstmLayer(numHiddenUnits,'OutputMode','last')
fullyConnectedLayer(50)
dropoutLayer(0.5)
fullyConnectedLayer(numResponses)
regressionLayer];
maxEpochs = 60;
miniBatchSize = 20;
options = trainingOptions('adam', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'InitialLearnRate',0.01, ...
'GradientThreshold',1, ...
'Shuffle','never', ...
'Plots','training-progress',...
'Verbose',0);
学習の際は、このコードで実行しようとしたところ、エラーが出力されてしまいました。
エラー内容:「無効な学習データです。出力モードが'last'である再帰層では、応答は数値応答の行列でなければなりません。」
net = trainNetwork(XTrain,YTrain,layers,options);
XTrainは、277×1 のcell配列で、各cellには、8個の指標の時系列データが格納されています。(8×n のdouble型)
YTrainは、277×1 のcell配列で、各cellには、各XTrainに対応する数値が格納されています。(1×1のdouble型)
データ形式が間違っているのか、学習のコードが間違っているのか、ご存じの方がいらっしゃいましたら、ご教示いただけたら幸いです。
よろしくお願いいたします。
3 Comments
Kenta
on 9 Aug 2019
応答は数値の行列、とエラーにあるので、Ytrainを227×1のdouble型で入れてはどうでしょう。今はcellですが、そのまま277×1(または1×227)のdouble型です。ただ、LSTMは経験がないのでわかりません。
Yoshito Saito
on 10 Aug 2019
Yoshito Saito
on 13 Aug 2019
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!