Emoji_v3a model() must give perfect accuracy

I can’t find the bug in

# Optimization loop
    for t in range(num_iterations): # Loop over the number of iterations
        for i in range(m):          # Loop over the training examples
            
            ### START CODE HERE ### (≈ 4 lines of code)
            {mentor edit: code removed}

Eventhough the assertion is ‘‘model() must give perfect accuracy’’ and pred = [0. 0. 0. 0. 0. 0. 0. 1. 1. 0. 0. 1.] instead of Y = [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1].
In the training cell below it seems like there’s a missmatch between the dimensions of avg and b (eventhough sentence_to_avg is initialized correctly with np.zeros(word_to_vec_map[any_word].shape)

Help, I’m staring at the 4 lines code for an hour.

Best,
Hannes

“forward propagate the avg” means you multiply by W and add b.
The instructions for Exercise 2 give you the equation.

Also, you should check your code for computing the cost.

Oh dear, I didn’t see the “.” in the formula. But the cost should be fine, it’s the vectorized version for the sum ;).

Does your code work correctly now?

Thanks, yes! After adding the dotproduct everything worked out!!

A note about using np.average would be useful in this problem as well.