make_regression
- sklearn.datasets.make_regression(n_samples=100, n_features=100, *, n_informative=10, n_targets=1, bias=0.0, effective_rank=None, , , , ,
Generate a random regression problem.
The input set can either be well conditioned (by default) or have a low
rank-fat tail singular profile. See make_low_rank_matrix for
more details.
The output is generated by applying a (potentially biased) random linear
regression model with n_informative nonzero regressors to the previously
generated input and some gaussian centered noise with some adjustable
scale.
Read more in the User Guide.
The number of samples.
The number of features.
The number of informative features, i.e., the number of features used to build the linear model used to generate the output.
The number of regression targets, i.e., the dimension of the y output vector associated with a sample. By default, the output is a scalar.
The bias term in the underlying linear model.
The approximate number of singular vectors required to explain most of the input data by linear combinations. Using this kind of singular spectrum in the input allows the generator to reproduce the correlations often observed in practice.
The input set is well conditioned, centered and gaussian with unit variance.
The relative importance of the fat noisy tail of the singular values
profile if effective_rank is not None. When a float, it should be
between 0 and 1.
The standard deviation of the gaussian noise applied to the output.
Shuffle the samples and the features.
If True, the coefficients of the underlying linear model are returned.
Determines random number generation for dataset creation. Pass an int for reproducible output across multiple function calls. See Glossary.
The input samples.
The output values.
The coefficient of the underlying linear model. It is returned only if coef is True.
>>> from sklearn.datasets import make_regression
>>> X, y = make_regression(n_samples=5, n_features=2, noise=1, random_state=42)
>>> X
array([[ 0.4967, -0.1382 ],
[ 0.6476, 1.523],
[-0.2341, -0.2341],
[-0.4694, 0.5425],
Effect of transforming the targets in regression model
Fitting an Elastic Net with a precomputed Gram Matrix and Weighted Samples
HuberRegressor vs Ridge on dataset with strong outliers
Ridge coefficients as a function of the L2 Regularization
Effect of model regularization on training and test error