Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created September 29, 2020 09:39
Embed
What would you like to do?
y_pred = np.array(clf.predict(x_test))
conf_mat = pd.DataFrame(confusion_matrix(y_test, y_pred),
columns=["Pred.Negative", "Pred.Positive"],
index=['Act.Negative', "Act.Positive"])
tn, fp, fn, tp = confusion_matrix(y_test, y_pred).ravel()
accuracy = round((tn+tp)/(tn+fp+fn+tp), 4)
print(conf_mat)
print(f'\n Accuracy = {round(100*accuracy, 2)}%')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment