Issue
I already referred these posts here and here and tried to plot the line of best fit for my linear regression problem.
So, my data shape looks like below
My code to plot the best fit line looks like below
plt.scatter(X_test.values, Y_test.values, color="black") # throws error in this line
plt.plot(Y_test, y_pred, color="blue", linewidth=3)
plt.xticks(())
plt.yticks(())
plt.show()
ValueError: x and y must be the same size
update - output
Solution
As of now, you are trying to plot 63 variables (from X_test
) which is not possible. The best solution is to pick one variable from your dataset and look at it. This is best if you have one particular variable you want to evaluate.
But, it seems like you want to understand your model's performance. Sklearn has a nice page on different metrics you could use to evaluate your regression model.
Answered By - StonedTensor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.