Skip to content

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

Open
@Buedenbender

Description

@Buedenbender

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions