I had the following error in my week 2 assignment, for this one, the number of iterations is 2000 and the code specified to add costs list every 100 iterations, so, I expect the array size of costs to be 20, however, the asserted result is 1? could someone please help take a look?

Thanks very much

I’m afraid that you “hardcode” num_iterations when you call optimize()…

This test actually set the number of iteration to 50. So, the array size should be 1.

You see several default values in parameters for model(). Those default parameters are used ONLY if a caller does not set those. In this case, a test program set num_iterations (and learning_rate) in different values. So, you need to pass variables, not hard coded values when you call optimize(). Please double check.

Thanks Nobu for your tip, I appreciate it a lot!

Hello

Please whenever I try to load my assignments, I keep getting this. What do I do to fix this? Thank you!

e

Hello, please I got an error that the size of d[‘w’] was not the same as the expected result but my previous exercises were correct without any problems. What might be wrong?

Hello @Rizama_Victor!

Maybe you “hardcode” the shape of W. Could you let me know which specific assignment and exercise this is?

Best,

Saif.

It’s Week two’s programming assignment exercise 8 precisely

The shape of the w matrix after initialization is (2,1) but the assertion requires it to be (4,1) for it to be correct

In addition, all other exercises in the assignment are correct

Hi @Rizama_Victor!

Firstly, make sure that your Ex. 4, `initialize_with_zeros`

, is correct as this function is used to initialize w and b.

Second, in Ex. 8, input to the `initialize_with_zeros`

function should be the `size of the w vector we want`

. You know what should be that, right? (Hint: For Ex. 4, it was `dim`

but for Ex. 8, it’s not `dim`

.) Ask yourself, what size of `w`

do we want or the size of `w`

depends on what?

Third, then you need to retrieve parameters w and b from the dictionary “params” correctly for the below code:

```
# Retrieve parameters w and b from dictionary "params"
# w = ...
# b = ...
```

Let me know if you need further explanation.

Best,

Saif.

The issue is with the argument passed to the “initialize_with_zeros” function. I initially passed in “dim” as the argument to the function meaning it was referencing the value used when the “initialize_with_zeros” was defined and hence it didn’t correspond with the expected output so I instead initialized dim to the correct integer but I then got this error message

“ValueError: shapes (1,4) and (2,3) not aligned: 4 (dim 1) != 2 (dim 0)”

You don’t need to use any `integer`

in `initialize_with_zeros`

. You know the shape of w is depend on X, right? So, what should be the argument to `initialize_with_zeros`

?

Best,

Saif.