+ 2
I'm getting Value error when building a model using anaconda
value error:found input variables with inconsistent numbers of samples:[1,178] The shape of both X and Y (train and test)are the same
3 Answers
+ 1
https://datascience.stackexchange.com/questions/20199/train-test-split-error-found-input-variables-with-inconsistent-numbers-of-sam
//Got this from one of my friends on discord Markus kaleton
Hope this helps
0
I saw this solution but it's still not working their shapes are equal(i.e X and y) ,It's still outputing the same error
0
Sounds like the shapes of your labels and predictions are not in alignment. I faced a similar problem while fitting a linear regression model . The problem in my case was, Number of rows in X was not equal to number of rows in y. In most case, x as your feature parameter and y as your predictor. But your feature parameter should not be 1D. So check the shape of x and if it is 1D, then convert it from 1D to 2D.
x.reshape(-1,1)
Also, you likely get problems because you remove rows containing nulls in X_train and y_train independent of each other. y_train probably has few, or no nulls and X_train probably has some. So when you remove a row in X_train and the same row is not removed in y_train it will cause your data to be unsynced and have different lenghts. Instead you should remove nulls before you separate X and y.
http://net-informations.com/ds/mla/default.htm