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

Skip to content

Commit 948582d

Browse files
DOC Ensures that SparseRandomProjection passes numpydoc validation (#21297)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
1 parent dfdaa45 commit 948582d

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
@@ -22,7 +22,6 @@
2222
"MultiTaskLassoCV",
2323
"OrthogonalMatchingPursuitCV",
2424
"PassiveAggressiveRegressor",
25-
"SparseRandomProjection",
2625
"SpectralBiclustering",
2726
"SpectralCoclustering",
2827
"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