フィルターのクリア

What is the training accuracy of this model?

5 ビュー (過去 30 日間)
LinkTo
LinkTo 2022 年 7 月 31 日
コメント済み: LinkTo 2022 年 8 月 3 日
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.

採用された回答

Chunru
Chunru 2022 年 8 月 1 日
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 件のコメント
Chunru
Chunru 2022 年 8 月 2 日
Try the following:
trainPred = classify(net, Signals,'SequenceLength','longest');
LinkTo
LinkTo 2022 年 8 月 3 日
It worked. Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by