Need help for C5W2A1, Exercise 2 - complete_analogy

Could someone tell me whats the problem of this error type:


thx for help

Those asserts mean your complete_analogy() function did not return the correct best_word.

That specific assert tests with:
word_a = ‘a’
word_b = ‘c’
word_c = ‘a’.

em I check the assert in test segment’s 4th test and ,the assert for word_a,word_b,word_c is correct.
Yet I find that the 4th test ask complete_analogy() function to return “c” as answear,while “c” is one of the input,does this right or just my another misunderstanding?

This function is to find the word which is similar to the relationship among first two.
An example in this notebook says;

a is to b as c is to ___”

In the case of 4th test (assert), it is interpreted as;

a is to c as a is to ___”

So, apparently, the answer is c. Of course, there may be another candidate which has the same vector as c. But, in the given word_to_vec_map, c is the only one.

yeah but the Comments says
“# loop over the whole word vector set

to avoid best_word being one of the input words, pass on them.”

and “c” is one of the input in 4th test.If I made correct code then “c” should be passed.I’m confused
(btw, I use print() to check the best_word of my code in 4th and the answear is “c_w”)

I’m afraid that you are using a different version. In my notebook, it clearly says,

to avoid best_word being one the input words, skip the input word_c

If you think about the algorithm, you will understand that the word to skip is the same one as the 3rd word, which is word_c, since the word vector becomes 0. This does not have any meanings.

ok i understand.thx again for your help,I will try another way
:melting_face: