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

Skip to content

Commit e90002a

Browse files
ArturoAmorQthomasjpfanjeremiedbb
committed
DOC Add docstring example to make_regression (#25551)
Co-authored-by: Thomas J. Fan <[email protected]> Co-authored-by: Jérémie du Boisberranger <[email protected]>
1 parent 51f7074 commit e90002a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sklearn/datasets/_samples_generator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,19 @@ def make_regression(
588588
coef : ndarray of shape (n_features,) or (n_features, n_targets)
589589
The coefficient of the underlying linear model. It is returned only if
590590
coef is True.
591+
592+
Examples
593+
--------
594+
>>> from sklearn.datasets import make_regression
595+
>>> X, y = make_regression(n_samples=5, n_features=2, noise=1, random_state=42)
596+
>>> X
597+
array([[ 0.4967..., -0.1382... ],
598+
[ 0.6476..., 1.523...],
599+
[-0.2341..., -0.2341...],
600+
[-0.4694..., 0.5425...],
601+
[ 1.579..., 0.7674...]])
602+
>>> y
603+
array([ 6.737..., 37.79..., -10.27..., 0.4017..., 42.22...])
591604
"""
592605
n_informative = min(n_features, n_informative)
593606
generator = check_random_state(random_state)

0 commit comments

Comments
 (0)