X=([-0.71239066, 0.45181234, -0.04450308, 0.75376638])
y=([ 44.18419163, 135.39949674, 96.51318381, 159.05759577])
y_pred1 = ((78.35 * X) + b).reshape(4)
plt.scatter(X,y)
plt.plot(X,reg.predict(X),color='red',label='OLS')
plt.plot(X,y_pred1,color='#00a65a',label='b = {}'.format(b))
plt.plot(X,y_pred,color='#A3E4D7',label='b = 0')
plt.legend()
plt.show()
I am using Matplotlib to draw regression lines. here is equation
78.35 * X + 100.... here y line should be intercept at 100
78.35 * X + 40.... here y line should be intercepted at 40
78.35 * X + 0.... here y the line should be intercepted at 0
But it doesn't happend.It is hard for me to understand that why it happened.Please check picture for matlib result
X
andy
into numpy arrays and removed two of the 3 plot-commands to get it running. It showed me the correct line and not the line from your plot. Furthermore: these are not the y-values from your scatter plot. $\endgroup$