text_plain_output_1.png image_output_1.png
from sklearn.datasets import make_regression

from sklearn.linear_model import LinearRegression

import matplotlib.pyplot as plt

X, y = make_regression(n_samples=4, n_features=1, n_informative=1, n_targets=1, noise=80, random_state=13)

from sklearn.linear_model import LinearRegression
reg = LinearRegression()
reg.fit(X, y)

(reg.coef_, reg.intercept_)

plt.scatter(X, y)
plt.plot(X, reg.predict(X), color='red')
plt.show()