I keep getting this error : 'Warning: index in position 1 exceeds array bounds (must not exceed 1)' while running Long short-term memory network

1 回表示 (過去 30 日間)
Woo Seok Jung
Woo Seok Jung 2018 年 9 月 7 日
回答済み: Vishal Bhutani 2018 年 9 月 10 日
load LSTMdata.mat
% LSTM Architecture:
% sequenceInputLayer -> bilstmLayer -> fullyConnectedLayer
% -> softmaxLayer -> classificationLayer
inLayer = sequenceInputLayer(3,'Name','inLayer');
lstm = bilstmLayer(100,'Name','lstm1','OutputMode','last');
fc = fullyConnectedLayer(2,'Name','fullyconnected');
sm = softmaxLayer('Name','softmax');
cf = classificationLayer('Name','classification');
layers = [inLayer;lstm;fc;sm;cf];
options = trainingOptions('adam',...
'Shuffle','every-epoch',...
'Plots','training-progress',...
'LearnRateDropPeriod',200,...
'LearnRateSchedule','piecewise');
net = trainNetwork(xtraindata,ytraindata,layers,options);
testPred = classify(net,XTest)
xtraindata and xtestdata are 140*1 cell array (each cell contains 3*1152 double array) and ytraindata is 140*1 categorical array. I also downloaded a sample neural network from mathworks website but I got the same error when I ran it. Please help!

回答 (1 件)

Vishal Bhutani
Vishal Bhutani 2018 年 9 月 10 日
Based on the information provided, the network architecture seems to be fine. You can just check one thing that the training and testing data are of same dimension. It would be helpful to provide the .mat file.

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by