Problem with Week 3 Exercise 10

The third and fourth unit test sentences for Course 2, Week 3, Exercise 10 have “-1” and “-2” tokens instead of <s> and <e> as in the first two, where perplexity is calculated correctly. To wit, the following sentences are tested:

  1. “i like a cat ”
  2. “i like a dog ”
  3. “in sunset sky is red -2”
  4. “i like a cat -2”
    I think -2, for example, is the encoding for <e>, but I don’t know why they are not used properly.

Is it possible to come back to an assignment once an issue has been addressed? I know it’s possible to submit the assignment more than once, with the highest grade being counted. I get a PASS 91% for this assignment, so I was hoping to go ahead and go onto Week 4, and resubmit this assignment once I receive a response.


I’ve finished Week 4 of Course 2, and would like to find out what I was doing wrong in Week 3 before proceeding to Course 3.
Am I the only person to have a problem with this assignment?

Hi Marshall_Mayberry,

In def test_calculate_perplexity in w3_unittest, for the third and fourth test case “-1” and “-2” are indeed used as “start_token” and “end_token” respectively. I do not know why this implementation was chosen but in my own version of the assignment it works.

As you get a 91% for this assignment there seems to be an issue with your implementation. Feel free to send me your notebook attached to a direct mail so I can have a look.

Hello, @reinoudbosch. Is there a way to get the assignment I turned on from the Coursear/DeepLearingAI? That’ll convince me that it is the latest one I was asking bout.


Hi Marshall_Mayberry,

Are you no longer able to access the third week’s assignment? If this is because your subscription ended, there’s not much I can do. If not, I think you should be able to access your assignment. Maybe you have to go to Open->File first and find the notebook you submitted.
In any case it may be useful for you to know that the models get more powerful in the third and fourth courses of the NLP specialization, so you could also decide to move on and learn about these first and then dive into the issue of perplexity with those more advanced models.

No, it’s definitely not letting me get back to prior work. Right now I can only enroll in the next Course (4) because I just finished Course 3. Even trying to use history to restore the page takes me to the end of Course 3. I can access a terminal session from my last assignment, but it’s tightly sandboxed.

Hmm, this may be current coursera policy. As a mentor there’s little I can do about it. I’ll pass this on to @Mubsi who may know what to do but who is currently out of office for a much needed break. So it may take a while before he will be able to respond. You could also try the coursera help desk.


Yes. I even remember trying logarithms, but to no avail. I’d like to know what I was doing wrong.

Hi @Marshall_Mayberry,

Is this something you still need help with ?


Hi, @mubsi,

As I was telling @reinoudbosch, I can’t get back to that assignment. I was able to still pass, but barely, then went on to later assignments.
Unless there is a way to access assignments that are considered finished, I don’t see how you could help me.
But, I really do appreciate your checking up on me.


I’m going to direct message your regarding this.