Due to broadcasting the size of w is changing which is creating problem in further tests of optimization. How to correct it?

That probably means that your â€śupdate parametersâ€ť logic in `optimize`

is incorrect. Print the shape of w before and after the update and see if it changes. The original w is an argument to `optimize`

, so it starts out being the right shape. So now your job is figure out where the shape became wrong.

BTW itâ€™s not a bug, you donâ€™t need to write out the implementation of `sigmoid`

again in `propagate`

. Youâ€™ve already written a function to do that, right? Why not just call it?

Hello @Aryavardhan_Singh_Ra,

Itâ€™s crucial for us to read the Error Traceback to give us some hints on how to solve an error.

Letâ€™s read your Error Traceback together. It complains about the shapes of your `w`

and `X`

, and from this part:

We can infer that it is receiving a `w`

that has a shape of `(3, 2)`

and a `X`

that has a shape of `(2, 2)`

. Or a `np.dot(w.T, X)`

that has a shape of `(3, 2)`

and a `b`

that has a shape of `(2, 2)`

. Then where do the `w`

, `X`

and `b`

come from? The Traceback told us, which is here:

Then we can go back to the notebook and look for that very line, and trace upwards to look for where `w`

,`X`

, and `b`

are actually defined which is here:

They do not have the shapes that the error complained. Also, they are codes provided by the assignment. So here are 2 steps I can suggest to you.

- Verify that they were not modified in your notebook
- Run them first, and run the problematic cell again right after, see if the same problem remains

Cheers,

Raymond

Thanks, I got it. I was not updating b correctly so that was causing problem.

I see. That makes sense. Thanks for letting us know!