Why is my data not working for the trainNetwork function?
古いコメントを表示
Hi all, I am creating a CNN with matlab. My data consists of 16 measurements of 7200000x1 numerical sequence data that respresents anal pressure. Each sample is labelled either 'n/a' or 'contraction'.
When I try to use the trainnetwork function to create 250x1 sequences, I get the following error:
Error using trainNetwork (line 184)
Invalid training data. Responses must be a cell array of categorical response sequences.
Error in YASTrainNetwork (line 96)
net = trainNetwork(Xtrain, Ytrain, layers, options);
However, the training data I am putting in is exactly as is described. I don't understand what I am doing wrong. This usually always works.
My training code is below and i attached the vars.mat file containing my Xtrain and Ytrain. Help would be greatly appreciated!
numSequence = size(raw2{1,1},1);
numHiddenUnits = 60;
InitialLearnRate = 0.0011113;
MaxEpochs = 2;
MiniBatchSize = 30;
layers = [...
sequenceInputLayer(numSequence,'Normalization', 'zscore')
bilstmLayer(numHiddenUnits,'OutputMode','sequence')
fullyConnectedLayer(3)
softmaxLayer
classificationLayer];
options = trainingOptions('adam', ...
'MaxEpochs',MaxEpochs, ...
'MiniBatchSize',MiniBatchSize, ...
'InitialLearnRate',InitialLearnRate, ...
'LearnRateDropPeriod',3, ...
'LearnRateSchedule','piecewise', ...
'GradientThreshold',1, ...
'Plots','training-progress',...
'shuffle','every-epoch',...
'SequenceLength',500,...
'Verbose',0,...
'ValidationData',{Xval,Yval},...
'ValidationFrequency',50,...
'ValidationPatience',inf,...
'DispatchInBackground',true );
net = trainNetwork(Xtrain, Ytrain, layers, options);
2 件のコメント
Walter Roberson
2022 年 7 月 31 日
編集済み: Walter Roberson
2022 年 7 月 31 日
Your .mat does not include raw2 so we cannot test your code.
Also, we need XVal and YVal.
Yasmin Ben Azouz
2022 年 7 月 31 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!