handson-ml2
handson-ml2 copied to clipboard
[QUESTION][2nd Chapter] LinearRegression() - Value Error
Hi sir, I have recently started reading your book and I'm in 2nd chapter now. till transformation pipeline I have got good knowledge and have implemented each line of code and practiced it as well.
But, coming to "Training and Evaluating on the Training Set" part, when I tried using linear regression an error is showing up by stating that "ValueError: Found input variables with inconsistent numbers of samples: [16512, 4128]"
from sklearn.linear_model import LinearRegression
lin_reg = LinearRegression()
lin_reg.fit(housing_prepared, housing_labels)
I'm not getting this issue and I'm stuck here, hope to hear back from you soon sir, Thank you
Your X is bigger than your Y. Post your code, otherwise no one can tell you what the bug is.