C2 W1 exercise 3 testing wrong for mysterious reasons

How possible? if the algo is wrong so everything must test wrong. Unless … the testing function has wrong expectations!

Wrong probability for word ‘thee’.
Expected: 0.1267.
Got: 0.004476442720185026.
Wrong probability for word ‘esteemed’.
Expected: 0.0016.
Got: 5.595553400231283e-05.
Wrong probability for word ‘your’.
Expected: 0.2096.
Got: 0.007404782332972731.
7 Tests passed
3 Tests failed

ABOUT ‘thee’
counts 240
where corpus is
len(word_l)=53614
so P(‘thee’) must be 0.004 circa

Hi @maxxflyer

Are you sure you did not use global variables in your functions? You could private message me your notebook and I could offer some insight.

Cheers

This is not true. Test function test for certain things.

For example, it could be the length of a dictionary, some specific value etc. In this case the unit test tested 10 different things, 7 of which you passed, but failed 3 (specific probabilities for certain words).

Cheers