8000 DOC Ensures that SparseRandomProjection passes numpydoc validation (#… · glemaitre/scikit-learn@e7221e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7221e3

Browse files
baam25simoglemaitre
andcommitted
DOC Ensures that SparseRandomProjection passes numpydoc validation (scikit-learn#21297)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
1 parent 602f3c3 commit e7221e3

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"MultiTaskLassoCV",
1919
"OrthogonalMatchingPursuitCV",
2020
"PassiveAggressiveRegressor",
21-
"SparseRandomProjection",
2221
"SpectralBiclustering",
2322
"SpectralCoclustering",
2423
"SpectralEmbedding",

sklearn/random_projection.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -617,23 +617,10 @@ class SparseRandomProjection(BaseRandomProjection):
617617
618618
.. versionadded:: 1.0
619619
620-
Examples
621-
--------
622-
>>> import numpy as np
623-
>>> from sklearn.random_projection import SparseRandomProjection
624-
>>> rng = np.random.RandomState(42)
625-
>>> X = rng.rand(100, 10000)
626-
>>> transformer = SparseRandomProjection(random_state=rng)
627-
>>> X_new = transformer.fit_transform(X)
628-
>>> X_new.shape
629-
(100, 3947)
630-
>>> # very few components are non-zero
631-
>>> np.mean(transformer.components_ != 0)
632-
0.0100...
633-
634620
See Also
635621
--------
636-
GaussianRandomProjection
622+
GaussianRandomProjection : Reduce dimensionality through Gaussian
623+
random projection.
637624
638625
References
639626
----------
@@ -645,6 +632,19 @@ class SparseRandomProjection(BaseRandomProjection):
645632
.. [2] D. Achlioptas, 2001, "Database-friendly random projections",
646633
https://users.soe.ucsc.edu/~optas/papers/jl.pdf
647634
635+
Examples
636+
--------
637+
>>> import numpy as np
638+
>>> from sklearn.random_projection import SparseRandomProjection
639+
>>> rng = np.random.RandomState(42)
640+
>>> X = rng.rand(100, 10000)
641+
>>> transformer = SparseRandomProjection(random_state=rng)
642+
>>> X_new = transformer.fit_transform(X)
643+
>>> X_new.shape
644+
(100, 3947)
645+
>>> # very few components are non-zero
646+
>>> np.mean(transformer.components_ != 0)
647+
0.0100...
648648
"""
649649

650650
def __init__(

0 commit comments

Comments
 (0)
0