Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in post: "Stop using 0.5 as the threshold for your binary classifier" #37

Open
Buedenbender opened this issue Mar 16, 2023 · 1 comment

Comments

@Buedenbender
Copy link

Buedenbender commented Mar 16, 2023

Just spent my evening binge reading through your blog posts, so thank you very much for the entertainment / educational material.
I spotted a minor mistake when trying to reproduce the code listing

from sklearn_evaluation.plot import ConfusionMatrix
# ...
cm_dot_five = ConfusionMatrix(y_test, y_pred)
cm_dot_five

Does not work, the following fixed it

from sklearn_evaluation import plot
# ...
cm_dot_five = plot.confusion_matrix(y_test, y_pred)
cm_dot_five

This error is repeated for the second ConfusionMatrix / confusion_matrix
I am not 100% sure but also I think the positional arguments should be
true label / predicted label (y_test,y_pred) (docs), instead in the
example below it looks like it is: (predicted_label_after_new_thresh,predicted_label)

cm_dot_four = ConfusionMatrix(y_score[:, 1] >= 0.4, y_pred)

Possible correction

cm_dot_four = plot.confusion_matrix(y_test, y_score[:, 1] >= 0.4)
@lfunderburk
Copy link
Contributor

Hi @Buedenbender
Thank you for raising this.
Can take a look at it and implement your fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants