Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adding more functionality to DecisionBoundaryDisplay #27462 #31558

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ansamz
Copy link
Contributor

@ansamz ansamz commented Jun 16, 2025

Hello,

Reference Issues/PRs

#27462 (partially)

What does this implement/fix? Explain your changes.

I tackled this part of StefanieSenger's request
add a title to the plot that clearly states which response_method from which estimator was used in the plot
what I did was save the response method and estimator in a variable in order to add them to the plot
and then using the set_title() mthod from matplotlib we can add the title to the plots.

Any other comments?

This is how I tested it on the iris dataset (not sure if this is the best approach to solving the issue)

disp_proba = DecisionBoundaryDisplay.from_estimator(
    classifier,
    X,
    response_method="predict_proba",
    xlabel=iris.feature_names[0],
    ylabel=iris.feature_names[1],
    alpha=0.5,
)
disp_proba.ax_.scatter(X[:, 0], X[:, 1], c=y, edgecolor="k", s=20)
title_proba = (
    f"Boundary: {disp_proba.estimator_name_}\n"
    f"Method: '{disp_proba.response_method_used_}'"
)
disp_proba.ax_.set_title(title_proba)
plt.show()

@betatim @glemaitre

Copy link

github-actions bot commented Jun 16, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 4698f29. Link to the linter CI: here

@betatim
Copy link
Member

betatim commented Jun 17, 2025

Thanks for making this PR and starting to tackle the issue!

What do you think about using the newly stored attributes in DecisionBoundaryDisplay.plot to set a title for the figure that it produces? That way people benefit "fot free" from this and get a nicer plot without having to do anything

@ansamz
Copy link
Contributor Author

ansamz commented Jun 21, 2025

First apologies for the late reply, had a hectic week, please let me know if you find this way better. attached an example of how it would look like.
Figure_1

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

Successfully merging this pull request may close these issues.

2 participants