Stuck on get_accuracy

Could anyone just explain me the error ?
My get_country is running correctly

TIA

Is it asking to create a set of tuples i.e. set((city1, ,country1, city2)) or just a set of the values?

Dictionary keys should be hashable. Please read about __hash__ here.
city1 should be a string and not a series object.

Thanks everyone for help, I got my error.

@Akshun_Jain Please share details about the fix so that other learners find it useful.


can someone help me please i am stuck on this my predict country function is not working the num correct is showing zero. i am defining city1 = row[‘city1’] and predicted_country2 = get_country(city1, country1, city2, word_embeddings) what wrong am i doing??

Adding nlp mentors:

@arvyzukai , @Elemento

Hey @Shahryar_Akbar,
If you look at the implementation of get_country, you will find that it returns 2 things, the most likely country and it’s corresponding similarity score. In the get_accuracy function, we only require the former of these 2 things, so instead of using

predicted_country2 = get_country(…)

use;

predicted_country2, _ = get_country(…)

Another way to access the predicted country without doing any changes to the code is accessing it by using predicted_country2[0]. I hope this helps.

P.S. - Thanks @balaji.ambresh for informing us.

Cheers,
Elemento