C5W2A1 Ex4 Operations_on_word_vectors_v2a (different result)

My result (from Exercise 4 - equalize) is different from the expected result by ~0.03. Please let me know if this is acceptable. if not, please also let me know where I made a mistake. I went over my code a few times and did not find the reason. thanks

cosine similarities after equalizing:
cosine_similarity(e1, gender) = -0.26641928819218963
cosine_similarity(e2, gender) = 0.2664192881921896

Expected result
|cosine_similarity(e1, gender) =|-0.23871136142883795|
|cosine_similarity(e2, gender) =|0.23871136142883792|

1 Like

Hello, ~0.03 should be a significant difference. I assume you got the cosine similarities before equalizing correct? If so, review each step of the equalize() function implementation. If this doesn’t get you move forward, pls send me the screenshot of your implementation.

2 Likes

@Rishan_Tan, we can’t access your notebook via your link. That’s not how it works. No one can see your notebook unless we’re logged into your account - which the mentors cannot do.

And you should not share your notebook in any case - that’s not allowed by the Code of Conduct (unless a mentor gives you specific instructions).

1 Like

I am sending you a screen capture of my code. not sure if I am doing it correctly.
I click on vhah DLS Mentor and then click on message

1 Like

I removed the link to my notebook. Maybe somewhere should have instruction on how to upload things for mentor to view

1 Like

If a mentor wants to see your notebook, we’ll contact you with instructions.

1 Like

Please just paste your screen capture image here. I can delete it after I read it.

1 Like

here is the screen capture
{image deleted}

1 Like

Your code is trying to do way too much.

There is no variable “pair” in this function.

You’re only supposed to use “word” to get “e” and then a dot product and “g”.

That’s it.

1 Like

My question is for EX4 (equalize) which does have the variable of “pair”. I am a bit confused. do you mean the problem that I see in EX4 is due to EX3 (neutralize) ?

1 Like

The code you posted seemed to be for the neutralize() function.

1 Like

The code I posted is for Ex4 which has 6 steps. I can send you the HTML file which may be easy to read. Let me know if it is needed. thanks.

1 Like

For those who find this thread later:

In the “neutralize()” function, ‘word’ was used as a text string, instead of as a variable name.

2 Likes

Thank you a lot. Similarly, this resolved the result difference that I saw in EX4

2 Likes