Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions sklearn/feature_extraction/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,31 @@ def img_to_graph(img, *, mask=None, return_as=sparse.coo_matrix, dtype=None):
def grid_to_graph(
n_x, n_y, n_z=1, *, mask=None, return_as=sparse.coo_matrix, dtype=int
):
"""Graph of the pixel-to-pixel connections
"""Graph of the pixel-to-pixel connections.

Edges exist if 2 voxels are connected.

Parameters
----------
n_x : int
Dimension in x axis
Dimension in x axis.
n_y : int
Dimension in y axis
Dimension in y axis.
n_z : int, default=1
Dimension in z axis
Dimension in z axis.
mask : ndarray of shape (n_x, n_y, n_z), dtype=bool, default=None
An optional mask of the image, to consider only part of the
pixels.
return_as : np.ndarray or a sparse matrix class, \
default=sparse.coo_matrix
The class to use to build the returned adjacency matrix.
dtype : dtype, default=int
The data of the returned sparse matrix. By default it is int
The data of the returned sparse matrix. By default it is int.

Returns
-------
graph : np.ndarray or a sparse matrix class
The computed adjacency matrix.

Notes
-----
Expand Down
1 change: 0 additions & 1 deletion sklearn/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"sklearn.decomposition._nmf.non_negative_factorization",
"sklearn.externals._packaging.version.parse",
"sklearn.feature_extraction.image.extract_patches_2d",
"sklearn.feature_extraction.image.grid_to_graph",
"sklearn.feature_extraction.image.img_to_graph",
"sklearn.feature_extraction.text.strip_accents_ascii",
"sklearn.feature_extraction.text.strip_accents_unicode",
Expand Down