Effacer les filtres
Effacer les filtres

What is the training accuracy of this model?

5 vues (au cours des 30 derniers jours)
LinkTo
LinkTo le 31 Juil 2022
Commenté : LinkTo le 3 Août 2022
I’m trying to classifiy ECG signals using LSTM and MATLAB, the above plot shows that the training accuracy of the system is 100% but when I apply this code to calculate and get the accuracy I get only 20%
LSTMAccuracy = sum(trainPred == Labels)/numel(Labels)*100
Am I missing something here? Or there something wrong I did in my code?
Here is the configuration and the training code:
layers = [ ...
sequenceInputLayer(1)
bilstmLayer(100,'OutputMode','last')
fullyConnectedLayer(5)
softmaxLayer
classificationLayer
]
options = trainingOptions('adam', ...
'MaxEpochs',1750, ...
'MiniBatchSize', 150, ...
'InitialLearnRate', 0.0001, ...
'ExecutionEnvironment',"auto",...
'plots','training-progress', ...
'Verbose',false);
net = trainNetwork(Signals, Labels, layers, options);
trainPred = classify(net, Signals,'SequenceLength',1000);
LSTMAccuracy = sum(trainPred == Labels)/numel(Labels)*100
figure
confusionchart(Labels,trainPred,'ColumnSummary','column-normalized',...
'RowSummary','row-normalized','Title','Confusion Chart for LSTM');
I really appreciate your help, thanks.

Réponse acceptée

Chunru
Chunru le 1 Août 2022
If Labels is character array instead of string array, then numel(Labels) will give the number of characters instead of the number of signals intended.
Labels =["abc"; "def"; "ghi"];
numel(Labels)
ans = 3
Labels =['abc'; 'def'; 'ghi'];
numel(Labels)
ans = 9
My guess is that you have a character arrays with 5 characters for each label. If this is the case, use the following
size(Labels, 2)
ans = 3
  9 commentaires
Chunru
Chunru le 2 Août 2022
Try the following:
trainPred = classify(net, Signals,'SequenceLength','longest');
LinkTo
LinkTo le 3 Août 2022
It worked. Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by