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

Skip to content

Commit ae1cfd5

Browse files
committed
DOC: image to graph utilities
1 parent 7b34fba commit ae1cfd5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

doc/modules/feature_extraction.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,3 +490,37 @@ implemented as an estimator, so it can be used in pipelines. See::
490490
>>> patches = image.PatchExtractor((2, 2)).transform(five_images)
491491
>>> patches.shape
492492
(45, 2, 2, 3)
493+
494+
Connectivity graph of an image
495+
-------------------------------
496+
497+
Several estimators in the scikit-learn can use connectivity information between
498+
features or samples. For instance Ward clustering
499+
(:ref:`hierarchical_clustering`) can cluster together only neighboring pixels
500+
of an image, thus forming contiguous patches:
501+
502+
.. figure:: ../auto_examples/cluster/images/plot_lena_ward_segmentation_1.png
503+
:target: ../auto_examples/cluster/plot_lena_ward_segmentation.html
504+
:align: center
505+
:scale: 40
506+
507+
For this purpose, the estimators use a 'connectivity' matrix, giving
508+
which samples are connected.
509+
510+
The function :func:`img_to_graph` returns such a matrix from a 2D or 3D
511+
image. Similarly, :func:`grid_to_graph` build a connectivity matrix for
512+
images given the shape of these image.
513+
514+
These matrices can be used to impose connectivity in estimators that use
515+
connectivity information, such as Ward clustering
516+
(:ref:`hierarchical_clustering`), but also to build precomputed kernels,
517+
or similarity matrices.
518+
519+
.. note:: **Examples**
520+
521+
* :ref:`example_cluster_plot_lena_ward_segmentation.py`
522+
523+
* :ref:`example_cluster_plot_segmentation_toy.py`
524+
525+
* :ref:`example_cluster_plot_feature_agglomeration_vs_univariate_selection.py`
526+

0 commit comments

Comments
 (0)