I need specificity
for my classification which is defined as :
TN/(TN+FP)
I am writing a custom scorer function :
from sklearn.
Remembering that in binary classification, recall of the positive class is also known as “sensitivity”; recall of the negative class is “specificity”, I use this:
unique, counts = np.unique(y_test, return_counts=True)
for i in unique:
score = precision_score(y_true, y_pred, labels=unique, pos_label=i)
print('score ' + str(i) + ' ' + str(score))