Skip to content

DOC Update Nearest Centroid DecisionBoundaryDisplay example - #33883

Merged
jeremiedbb merged 3 commits into
scikit-learn:mainfrom
AnneBeyer:dbd_fix_color_nearest_centroid
May 5, 2026
Merged

jeremiedbb merged 3 commits into
scikit-learn:mainfrom
AnneBeyer:dbd_fix_color_nearest_centroid

Conversation

@AnneBeyer

Copy link
Copy Markdown
Member

Reference Issues/PRs

Towards #33557

What does this implement/fix? Explain your changes.

It now uses the default colors for the display and re-uses the colors from the display for the scatterplot.
I also added a link to the user guide and some more details.

AI usage disclosure

I used AI assistance for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Any other comments?

It could make sense to use an example where the shrinkage setting has a larger effect, but since this issue/PR is mainly concerned with color consistency, I will leave this for the future.

Comment on lines 33 to +34
y_pred = clf.predict(X)
print(shrinkage, np.mean(y == y_pred))
acc = np.mean(y == y_pred)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to prefer this over clf.score(X, y)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These days we don't want to promote using the default scorer of estimators. We could use accuracy_score though. But I would not put a lot of effort on this example. It's the kind of example that I believe we'd like to remove, or merge with other one(s) to have more complete examples.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. I'll add this to my list.

@AnneBeyer AnneBeyer changed the title DOC Update DecisionBoundaryDisplay example DOC Update Nearest Centroid DecisionBoundaryDisplay example Apr 28, 2026

@jeremiedbb jeremiedbb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks !

@jeremiedbb
jeremiedbb merged commit 21eb2ba into scikit-learn:main May 5, 2026
33 checks passed
@AnneBeyer
AnneBeyer deleted the dbd_fix_color_nearest_centroid branch June 4, 2026 10:48
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