You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that we should expose the pos_label as one of the parameters of plot_precision_recall_curve. I even think that we should issue a warning in case of class imbalance and that the positive class considered is the one with most samples. In most of cases, you are reporting the wrong part of your result but it might be what we give as a result with defaults.
importpandasaspdfromsklearn.datasetsimportfetch_openmlfromsklearn.model_selectionimporttrain_test_splitfromsklearn.linear_modelimportLogisticRegressionfromsklearn.metricsimportplot_precision_recall_curveX, y=fetch_openml(
name="blood-transfusion-service-center",
as_frame=True, return_X_y=True,
)
# Make columns and classes more human-readableX.columns= ["Recency", "Frequency", "Monetary", "Time"]
y=y.apply(
lambdax: "donated"ifx=="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)
The text was updated successfully, but these errors were encountered:
I think that we should expose the
pos_label
as one of the parameters ofplot_precision_recall_curve
. I even think that we should issue a warning in case of class imbalance and that the positive class considered is the one with most samples. In most of cases, you are reporting the wrong part of your result but it might be what we give as a result with defaults.The text was updated successfully, but these errors were encountered: