I faced a similar problem while fitting a regression model . The problem in my case was, Number of rows in X was not equal to number of rows in y. 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.
In the above, x is considered as the feature parameter and y as the predictor. You need to make sure that the feature parameter is not 1D. Hence, you will need to check the shape of X. If it is 1D, then you will need to convert it from !D to 2D.
In your code, you have specified x as a feature parameter and y as a predictor. The feature parameter should not be 1D. So you have to change it to 2D.
You can check the shape of x using,
You can then reshape x,
If you want to unleash your potential in this competitive field, please visit the Machine Learning Training page for more information, where you can find the and as well.
For more updates on the latest courses stay tuned to HKR Trainings.