Skip to content

RFC: deprecate plot method in DecisionBoundaryDisplay? #33159

Closed

Description

@AnneBeyer

Repeating this here from #33115 (comment):

There are two paths to create a DecisionBoundaryDisplay plot (we recommend the second, but the first is also possible):

display = DecisionBoundaryDisplay(...)
display.plot()

and

display = DecisionBoundaryDisplay.from_estimator(...)
# which internally calls `display.plot()`

This leads to inconsistent/duplicate parameter checking in both functions.

The only place where the first option is used in our repo is in the example for the class itself, and calling it requires calculating the grid response values from an estimator anyway.

>>> feature_1, feature_2 = np.meshgrid(
... np.linspace(iris.data[:, 0].min(), iris.data[:, 0].max()),
... np.linspace(iris.data[:, 1].min(), iris.data[:, 1].max())
... )
>>> grid = np.vstack([feature_1.ravel(), feature_2.ravel()]).T
>>> tree = DecisionTreeClassifier().fit(iris.data[:, :2], iris.target)
>>> y_pred = np.reshape(tree.predict(grid), feature_1.shape)
>>> display = DecisionBoundaryDisplay(
... xx0=feature_1, xx1=feature_2, response=y_pred
... )
>>> display.plot()

So if I'm not mistaken, the public plot() function doesn't add much here, and removing it would simplify the code and make adding more functionality (like planned in #33115, #33094 and #27462) easier.

WDYT? @ogrisel @lucyleeow @ThexXTURBOXx
(and @adrinjalali @glemaitre just in case you have time to take a look)

Note: I did not check if the same applies to any other Display class yet.

Activity

  1. added
    Needs Triage
    on Jan 30, 2026
  2. lucyleeow commented on Feb 2, 2026

    @lucyleeow
    Member

    You raise a good point, and indeed DecisionBoundaryDisplay is (I think) the only class that only has a from_estimator method (and not a from_predictions or even from_cv_results method).

    The other classes all have more than one method that ultimately calls plot to make the plot.

    The first display class was added in #14357 , I haven't extensively dug through it but it should provide good background on why implementation/design decisions where made.

    In particular, it was decided to have the plot method because:

    I think for those reasons and to keep consistency between display classes we should keep plot.

    Again I think delaying param validation to plot is okay, as performance is probably not critical for plotting. Also take a look at the _BinaryClassifierCurveDisplayMixin class, which I think does some standard param validation for each display method (e.g., _validate_plot_params, _validate_from_predictions_params etc)

  3. removed
    Needs Triage
    on Feb 2, 2026
  4. AnneBeyer commented on Feb 3, 2026

    @AnneBeyer
    MemberAuthor

    Thank you for the context! I suspected that there are more complex decisions behind it. I'll have a look at them and will close this issue again for now.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions