C5W2 Assignment 1 - debiasing result is not zero

The cosine similarity between receptionist and g_unit, after neutralizing is -0.1199710913018051 but not 3.5723165491646677e-17 as shown in the expected output. The cosine similarity between receptionist and g_unit is not close to zero, meaning the gender associated component is not removed. What could be the reason that cause this result deviating significantly from zero?

I was able to get the same answers that they show there. So I guess the theory would have to be that your code is wrong. Please compare what you wrote again carefully to the mathematical formula as shown. Note that the term in the denominator there is ||g||^2_2 which means the square of the 2-norm of the vector g. That can be efficiently implemented as:

\displaystyle \sum_{i = 1}^n g_i^2

Also note that in addition to that scalar factor in the denominator, the formula involves both a dot product and an elementwise multiply.