#W2E5 Error with dimensions in 'model'

Programming Assignment: Logistic Regression with a Neural Network Mindset

I am on exercise 5 of the assignment, in the ‘model’ function where we put together the functions from the previous exercises into the model. All the previous functions pass, but when I collate them in the model there is an issue with dimensions. Maybe I am passing something incorrectly, or maybe I have missed a step, but I cannot see it. This gets triggered by the model_test(model), with the trace being below:

{mentor edit: code removed}

There are some issues here:

  1. These should be X_train and Y_train. Not X and Y. There are no X and Y variables inside the model() function. X_train and Y_train are passed to the model() function as parameters.

  2. Do not hard-code these values. Just pass-through the variables that are provided in the model() function definition.

Also, another problem here:
image

These should be X_test and X_train. You don’t pass any ‘Y’ values to a predict function. You’re trying to compute the predictions after training. For that you need w, b, and some X data.

In the future, please don’t post your code on the forum. That isn’t allowed by the Code of Conduct.