import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression X = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).reshape(-1, 1) Y = np.array([3, 4, 2, 5, 6, 8, 7, 9, 10, 12]) model = LinearRegression().fit(X, Y) plt.scatter(X, Y, color='blue') # Data points plt.plot(X, model.predict(X), color='red') # Regression line plt.xlabel("X (Input Feature)") plt.ylabel("Y (Output)") plt.title("Simple Linear Regression") plt.grid(True) plt.show()