フィルターのクリア

Training LTSM network error in command window

2 ビュー (過去 30 日間)
G.N. Cobbold
G.N. Cobbold 2020 年 11 月 28 日
回答済み: Rishik Ramena 2020 年 12 月 7 日
'Invalid training data. Responses must be a vector of categorical responses, or a cell array of categorical response
sequences.'
Hello I am currently training a LTSM classifaction network, in which i keep coming into this same error line. I have two data types. Firstly, my xtrain is a cell array of (3 x 900 double) whilst my ytrain is a cell array with categorical vectors( 3x 900 categorical). I am running this code to provide me a netowrk which will window temproal data of the sensor readings. I initally suspected that the error was due to my ytrain, in which i have countlessly spent time to change this data type to get desired result. Could this error be po potentially an error with my xtrain?
[net] = trainNetwork(xtrain,ytrain,layers,options);
numFeatures = 1;
numHiddenUnits = 200;
numClasses = 3;
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits,'OutputMode','sequence')
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer];
options = trainingOptions('adam', ...
'MaxEpochs',250, ...
'GradientThreshold',1, ...
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',125, ...
'LearnRateDropFactor',0.2, ...
'Verbose',0, ...
'Plots','training-progress');
%'MaxEpochs',60, ...
%'GradientThreshold',2, ...
%'Verbose',0, ...
%'Plots','training-progress');
%ytrain=categorical(ytrain);
%ytrain = transform(ytrain,@(data) padSequence(data,sequenceLength));
[net] = trainNetwork(xtrain,ytrain,layers,options);
%net = trainNetwork(xtrain,Ytrain,layers,options);
t_training=t_training+toc;

回答 (1 件)

Rishik Ramena
Rishik Ramena 2020 年 12 月 7 日
You probably need to convert the ytrain to categorical while passing to trainNetwork.
ytrain=categorical(ytrain);
[net] = trainNetwork(xtrain,ytrain,layers,options);

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by