Mismatch in the dimensions

I am not able to understand why I am getting this mismatch in the dimensions. Here is the drive file and the screenshot of the error

drive.google.com/file/d/1Z554WjUl1AgpO6w5OCJwhGB9ZdUk36nJ/view?usp=sharing

hey @A18ML0031 ,
problem in your code is that .
You adding an extra 1 in X_train, but not doing so for X_test.
So due to this , your X_train is of shape (,4) where as X_test is of shape (,3).
Just do that for X_test also.
Everything will work absolutely fine.

I hope this helped you.
Thank You and Happy Learning :slightly_smiling_face:.

Ohhh. I didn’t catch that. Thanks for helping out.

My accuracy is coming out to be 29% now. Should i share the notebook file?

Yeah please it would easy for me to help you out then.

Here is the drive link to the file: drive.google. com/file/d/1Z554WjUl1AgpO6w5OCJwhGB9ZdUk36nJ/view?usp=sharing

Remove the space after ‘google’ and before ‘.com’

hey @A18ML0031 ,
if you check your code , then you have mistakenly taken different variable to store weights while training your model. ( small w and capital W )

So just change them to be same then you will get very good results.

The ‘W’ I have used is to indicate that I am initialising the random weights which will give the loss, weights and bias from the gradient_descent method used to train the model. However, further when I am predicting the results for X_test, I am using the weights that have been learned by the model on training on the X_train based on the random weights ‘W’. The final weights are stored in the variable ‘w’ which I have used when making predictions.

Are you saying that I am supposed to keep the variables same to be either “W” or “w” throughout the code?

Yes.
Because we update our weights and for that we need to use the same variable of weights , all over same.
As with that only we will be able to update our weights and train properly.

Hi, I have made the required changes. I am still getting very low accuracy after all that

do one thing , kindly update your code and upload it on google colab and share its link here.
Let me have a look at it once.