application_vnd.jupyter.stderr_output_1.png image_output_1.png
from sklearn.linear_model import LinearRegression

import matplotlib.pyplot as plt

import numpy as np

import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
np.random.seed(0)
x = np.random.rand(100, 1)
y = 2 + 3 * x + np.random.rand(100, 1)
model = LinearRegression()
model.fit(x, y)
plt.scatter(x, y, s=10)
plt.plot(x, model.predict(x), color='r')
plt.xlabel('X')
plt.ylabel('Y')
plt.show()