Weighted accuracy, sensitivity and specificity

I have a confusion matrix TN= 27 FP=20 FN =11 TP=6

I want to calculate the weighted average for accuracy, sensitivity and specificity. I know the equation but unsure how to do the weighted averages.

Topic weighted-data accuracy confusion-matrix python machine-learning

Category Data Science


Taking in consideration that: enter image description here

Weighted Average Precision, Recall, f1score, specificity, could be calculated using:

enter image description here

enter image description here

enter image description here

enter image description here

I have some codes, you can check it in, and the complete references:

[0] https://github.com/sisifo3/Metrics_Imbalanced_learn

3 https://www.youtube.com/watch?v=5ySAKEzZTZA

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.