Why is my data not working for the trainNetwork function?
Mostra commenti meno recenti
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 Commenti
Walter Roberson
il 31 Lug 2022
Modificato: Walter Roberson
il 31 Lug 2022
Your .mat does not include raw2 so we cannot test your code.
Also, we need XVal and YVal.
Yasmin Ben Azouz
il 31 Lug 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Deep Learning Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!