Skip to content

Added documentation reference to plot_segmentation_toy.py to spectral.py #30978

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sklearn/cluster/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ class SpectralClustering(ClusterMixin, BaseEstimator):
If the affinity matrix is the adjacency matrix of a graph, this method
can be used to find normalized graph cuts [1]_, [2]_.

For an example of spectral clustering applied to image segmentation
using normalized cuts, see
:ref:`sphx_glr_auto_examples_cluster_plot_segmentation_toy.py`

Comment on lines +393 to +394
Copy link
Contributor

@StefanieSenger StefanieSenger Mar 14, 2025

Choose a reason for hiding this comment

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

Suggested change
:ref:`sphx_glr_auto_examples_cluster_plot_segmentation_toy.py`
:ref:`sphx_glr_auto_examples_cluster_plot_segmentation_toy.py`.

Also, please delete one of the empty lines below. It causes one of the CI tests to fail.


When calling ``fit``, an affinity matrix is constructed using either
a kernel function such the Gaussian (aka RBF) kernel with Euclidean
distance ``d(X, X)``::
Expand Down
Loading