Skip to content

DOC Ensures that SpectralCoclustering passes numpydoc validation #21282

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
wants to merge 2 commits into from
Closed
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
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"SelfTrainingClassifier",
"SparseRandomProjection",
"SpectralBiclustering",
"SpectralCoclustering",
"SpectralEmbedding",
"StackingRegressor",
"TransformedTargetRegressor",
Expand Down
1 change: 0 additions & 1 deletion sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,6 @@ def get_indices(self, i):
Indices of rows in the dataset that belong to the bicluster.
col_ind : ndarray, dtype=np.intp
Indices of columns in the dataset that belong to the bicluster.

"""
rows = self.rows_[i]
columns = self.columns_[i]
Expand Down
29 changes: 20 additions & 9 deletions sklearn/cluster/_bicluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,20 @@ def _check_parameters(self):
)

def fit(self, X, y=None):
"""Creates a biclustering for X.
"""Create a biclustering for X.

Parameters
----------
X : array-like of shape (n_samples, n_features)
Training instances to cluster.

y : Ignored
Not used.
Copy link
Member

Choose a reason for hiding this comment

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

Replace with

        y : Ignored
            Not used, present for API consistency by convention.


Returns
-------
self: object
Copy link
Member

Choose a reason for hiding this comment

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

Replace with

self : object

Fitted biclustering for X.
Copy link
Member

Choose a reason for hiding this comment

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

Replace with

Returns a fitted instance.

"""
X = self._validate_data(X, accept_sparse="csr", dtype=np.float64)
self._check_parameters()
Expand Down Expand Up @@ -255,6 +261,13 @@ class SpectralCoclustering(BaseSpectral):
initialization. Use an int to make the randomness deterministic.
See :term:`Glossary <random_state>`.

References
----------

* Dhillon, Inderjit S, 2001. `Co-clustering documents and words using
bipartite spectral graph partitioning
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.140.3011>`__.

Attributes
----------
rows_ : array-like of shape (n_row_clusters, n_rows)
Expand Down Expand Up @@ -284,6 +297,12 @@ class SpectralCoclustering(BaseSpectral):

.. versionadded:: 1.0

See Also
--------
SpectralClustering: Performs a low-dimension embedding of the
affinity matrix between samples, followed by clustering, e.g., by KMeans,
of the components of the eigenvectors in the low dimensional space.
Comment on lines +302 to +304
Copy link
Member

Choose a reason for hiding this comment

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

I am not able to make suggestions. I assume that when opening the PR, you unchecked the checkbox that allows maintainers to make some editing.

Here, you should replace with:

SpectralClustering : Apply clustering to a projection of the normalized Laplacian.


Examples
--------
>>> from sklearn.cluster import SpectralCoclustering
Expand All @@ -297,14 +316,6 @@ class SpectralCoclustering(BaseSpectral):
array([0, 0], dtype=int32)
>>> clustering
SpectralCoclustering(n_clusters=2, random_state=0)

References
----------

* Dhillon, Inderjit S, 2001. `Co-clustering documents and words using
bipartite spectral graph partitioning
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.140.3011>`__.

"""

def __init__(
Expand Down