FP = 0
TN = 0
FN = 0
for i in range(len(y_hat)):
    if y_actual[i] == y_hat[i] == 1:
        TP += 1
for i in range(len(y_hat)):
    if y_hat[i] == 1 and y_actual != y_hat[i]:
        FP += 1
for i in range(len(y_hat)):
    if y_actual[i] == y_hat[i] == 0:
        TN += 1
for i in range(len(y_hat)):
    if y_hat[i] == 0 and y_actual != y_hat[i]:
        FN += 1
return TP, FP, TN, FN
Scikit-learn: How to obtain True Positive, True Negative, False Positive and False Negative