Linear Regression Synthetic Data using Make Regression

Though we have many datasets available on internet for implementing Linear Regression , many a times we may require to create a our own synthetic data.

Scikit-Learn has a class called make regression , we can use this class to generate synthetic data for linear regression.

from sklearn.datasets import make_regression
# generate regression dataset
x, y = make_regression(n_samples=20, n_features=1, noise=0.75)
Synthetic data using make regression
Synthetic data using make regression

We can also create synthetic data for linear regression only using numpy in this post as linear synthetic data using numpy.

Leave a Reply