I don’t understand the error below. Why is the verification function expecting something else than 0 ?

Thank you for your help

I don’t understand the error below. Why is the verification function expecting something else than 0 ?

Thank you for your help

Here’s another recent thread on this assignment. Please have a look and see if that sheds any light on your issues. In one of my replies there, I show some debugging output that is worth a look.

1 Like

There must be something wrong in your implementation. It’s a bit hard to diagnose with the input “I have a problem”. Please note that the mentors do not have the superpower to examine anyone else’s notebooks. What is your output equivalent to what I show on the other thread I referenced above?

These are my outputs

```
V = 9165, len(wordlist) 11436
V: 9165, V_pos: 5804, V_neg: 5632, D: 8000, D_pos: 4000, D_neg: 4000, N_pos: 27547, N_neg: 27152
freq_pos for smile = 47
freq_neg for smile = 9
loglikelihood for smile = 1.5577981920239676
0.0
9165
```

That’s good: your numbers look correct for *N_pos* and *N_neg*. How about the specific numbers for “smile”?

Hmmm, that is correct as far as I can see. Time to use the “in case of emergency, break glass” method. Please check your Direct Messages.

It turns out your error message (which you never actually showed us) is exactly the same as the one in the original post on this thread. Note that the *logprior* value is only based on *D_pos* and *D_neg*. In your case and the OP, your answer for *logprior* is 0.0, meaning that *D_pos* and *D_neg* are equal. In the test case in the notebook, that is actually true, but in the test imported from the public test file, that is no longer true. So there must be a bug in your logic that causes *D_pos* and *D_neg* to be equal when they shouldn’t be. So that is a pretty big clue as to where to look for the error.

Here is the complete output I get with my extra debugging statements for the test case from the imported unit tests:

```
V: 9165, V_pos: 5804, V_neg: 5632, D: 8000, D_pos: 4000, D_neg: 4000, N_pos: 27547, N_neg: 27152
freq_pos for smile = 47
freq_neg for smile = 9
loglikelihood for smile = 1.5577981920239676
V: 9165, V_pos: 5804, V_neg: 5632, D: 20, D_pos: 10, D_neg: 10, N_pos: 27547, N_neg: 27152
freq_pos for smile = 47
freq_neg for smile = 9
loglikelihood for smile = 1.5577981920239676
V: 9165, V_pos: 5804, V_neg: 5632, D: 15, D_pos: 10, D_neg: 5, N_pos: 27547, N_neg: 27152
freq_pos for smile = 47
freq_neg for smile = 9
loglikelihood for smile = 1.5577981920239676
All tests passed
```

So you can see that there are a couple of test cases where *D_pos* and *D_neg* are not equal.