-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
plot_precision_recall_curve and plot_roc_curve don't allow picking positive class #15573
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
Comments
Do you mean as a generic constructor params for all (binary) classifiers? |
can I start to work on this issue? |
@claramatos we first need to agree on what's need to be done. I am not sure what @amueller has in mind. |
Initial post in #17565 I think that we should expose the import pandas as pd
from sklearn.datasets import fetch_openml
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import plot_precision_recall_curve
X, y = fetch_openml(
name="blood-transfusion-service-center",
as_frame=True, return_X_y=True,
)
# Make columns and classes more human-readable
X.columns = ["Recency", "Frequency", "Monetary", "Time"]
y = y.apply(
lambda x: "donated" if x == "2" else "not donated"
).astype("category")
X_train, X_test, y_train, y_test = train_test_split(
X, y, shuffle=True, random_state=0, test_size=0.5
)
classifier = LogisticRegression().fit(X_train, y_train)
plot_precision_recall_curve(classifier, X_test, y_test) One would have expected the following instead: |
@glemaitre I was thinking about implementing it as you are suggesting, exposing the pos_label (having 1 as default) |
@claramatos You can open a PR. IMO, I already opened #17569 before to find this issue. So you can focus on the |
@claramatos did you have time to work on the issue related to the |
@glemaitre I'm planning to work on it over the weekend |
I was looking into |
In #15555 we removed the inconsistent
pos_label
attribute.It would be good to allow users to specify which class is the semantically positive class and slice
predict_proba
ordecision_function
accordingly.I'm not sure if that parameter should be called
pos_label
as it is somewhat semantically different. Maybepositive_label
?positive_class
? but it's not clear that that's different. We could douse_as_positive=
but that's a bit obscure maybe?Also see #15405 (comment)
The text was updated successfully, but these errors were encountered: