Repository navigation
Conversation
…of an estimator and features.
NicolasHug
left a comment
There was a problem hiding this comment.
Thanks for the PR @jhennrich
Don't worry about CI failing for now, it's unrelated.
please add a few tests. We would also need a short sentence in the user guide (doc/modules/model_evaluation.rst) to document this feature
|
thanks, please apply similar changes to plot_roc_curve and plot_precision_recall_curve |
|
Maybe we can make changes to the other functions in another PR |
|
@NicolasHug: I fixed everything you suggested and added tests. |
|
Hi, what happened with this? it seems ready to be merged. What are the plans for ROC curve and others? I feel quite inefficient having to predict again if I want to plot the ROC curve On a similar matter, what do you think in general about having just one function with a boolean to plot? wouldn't that simplify a lot the API? I think this would be nice because maybe you want to plot the CM, ROC, etc, and also have it. For example, you wanna plot the ROC curve and choose the threshold |
|
@marctorrellas There is a discussion on #15880 going through if we want inflate the API of this function. In summary, having two interfaces in one function feels like it will lead to an inflated API. The way to do this with already computed predictions would be to: from sklearn.metrics import ConfusionMatrixDisplay
y_pred = est.predict(...)
confusion_matrix = confusion_matrix(y_true, y_pred)
display_labels = [...]
disp = ConfusionMatrixDisplay(confusion_matrix=confusion_matrix,
display_labels=display_labels).plot(...) |
thanks so much for your answer! didn't realise about those *****Display 👍 |
|
Now that ConfusionMatrix.from_predictions is released, we can now plot the confusion matrix from the predictions directly. With that in mind, I am closing this PR. Thank you for working on this PR! |
Allow passing predicted labels
y_predtoplot_confusion_matrixthat will be used instead ofestimatorandX. In order to maintain backwards compatibility,y_predis added as an optional keyword argument.When both
estimatorandXaswell asy_predare passed, a ValueError is raised since it is unclear which of both should be used.For the discussion see #15880