What is the training accuracy of this model?

9 visualizaciones (últimos 30 días)
LinkTo
LinkTo el 31 de Jul. de 2022
Comentada: LinkTo el 3 de Ag. de 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.

Respuesta aceptada

Chunru
Chunru el 1 de Ag. de 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 comentarios
Chunru
Chunru el 2 de Ag. de 2022
Try the following:
trainPred = classify(net, Signals,'SequenceLength','longest');
LinkTo
LinkTo el 3 de Ag. de 2022
It worked. Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by