How to calculate sensitivity and specificity from Deep Network trained data?

2 vues (au cours des 30 derniers jours)
Theodora Chivu
Theodora Chivu le 8 Jan 2021
Réponse apportée : Jayanti le 24 Déc 2024
I have trained a data with my network arhitecture and i got an accuracy of 75.6%. I want to calculate specificity and sensitivity using trained Info. My final validation loss is 0.5328 and final validation accuracy is 75.6.

Réponses (1)

Jayanti
Jayanti le 24 Déc 2024
Hi Theodora,
To calculate sensitivity and specificity for a trained neural network you can follow the below steps :-
  1. Ensure you have a test dataset with true labels and predictions from your neural network.
  2. Use the trained network to make predictions.
  3. Then identify the number of cases for True positive, True negative, False positive and False negative.
  4. Use below formulas to calculate sensitivity and specificity
sensitivity = TP / (TP + FN)
specificity = TN / (TN + FP)
y_true = [1, 0, 1, 1, 0, 1, 0, 0, 1, 0];
y_pred = [1, 0, 1, 0, 0, 1, 1, 0, 1, 0];
confMat = confusionmat(y_true, y_pred);
TP = confMat(2, 2);
TN = confMat(1, 1);
FP = confMat(1, 2);
FN = confMat(2, 1);
sensitivity = TP / (TP + FN);
specificity = TN / (TN + FP);
You may refer to the below MathWorks documentation to know more on “confusionmat” function:

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