Skip to content

DOC fix colors and add support vectors in SVM with custom kernel example - #33891

Merged
lorentzenchr merged 2 commits into
scikit-learn:mainfrom
AnneBeyer:dbd_fix_colors_custom_kernel
May 6, 2026
Merged

lorentzenchr merged 2 commits into
scikit-learn:mainfrom
AnneBeyer:dbd_fix_colors_custom_kernel

Conversation

@AnneBeyer

Copy link
Copy Markdown
Member

Reference Issues/PRs

Towards #33557

What does this implement/fix? Explain your changes.

Adapts the color selection to use multiclass_colors instead of cmap.
Also, the text says that it plots the support vectors, but it actually just plotted all datapoints, so I added a highlighting for those as well.
I also removed an unused variable and cleaned the docstrings a bit.

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?

@virchan virchan 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, @AnneBeyer!

@virchan virchan added Quick Review For PRs that are quick to review Waiting for Second Reviewer First reviewer is done, need a second one! labels May 1, 2026
Comment thread examples/svm/plot_custom_kernel.py Resolved
Comment on lines +57 to +63
# Highlight the support vectors
plt.scatter(
X[clf.support_, 0],
X[clf.support_, 1],
facecolor="none",
edgecolors="k",
)

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.

I can't spot a difference.

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.

Only the support vectors are highlighted with black edges now:
image

Co-authored-by: Christian Lorentzen <[email protected]>
@lorentzenchr
lorentzenchr merged commit 97d6cbd into scikit-learn:main May 6, 2026
38 of 39 checks passed
@AnneBeyer
AnneBeyer deleted the dbd_fix_colors_custom_kernel branch June 4, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants