C2_w4 issue / not running at all

hello, I have a problem with c2_w4. As soon as I try to run any function it is like the kernel stops working. It won’t give me any results or errors or anything and on top of that it will stop printing anything on the code sections. I’ve had that problem for some days now and it does not go away. The course 3 practice lab on the other hand work great.

Hello @raptistitos, welcome to our community!

To help understand your situation, please answer the following questions 1, 2a, and 2b one by one.

  1. Are you running the C2 W4 assignment on coursera?

  2. Open the assignment on coursera, on the menu bar, click “Kernel” > “Restart & Clear Output”, then on the menu bar again, click “Cell” > “Run all”. As the code cells finishes running, a cell number will appear on the L.H.S. of the cell,
    a. What is the last cell number that shows up?
    b. Any error message do you see?

hello there, thank you for the immediate response.

  1. yes I am running it on coursera.
  2. a. I am not really sure what you mean with ‘cell number’. The content of the last cell however is this
    ‘build_tree_recursive(X_train, y_train, root_indices, “Root”, max_depth=2, current_depth=0)’
    b. when clicking on “Cell” > “Run all”, after a while (probably after it finishes running) an error sign appears on the menu bar where we have the “kernel”, “cell” etc.
    Still I cant run anything.

Hi, can you please do my (2) again and share with me about (2a)? By cell number, I mean if you look at the screenshot below, there is a In [1]: next to the code cell. The cell number of this code cell is 1 which is in the square brackets. This is the number I need. What is the largest number that you can see? Please make sure to follow my steps listed in (2)

For your answer to 2b, can you take a screenshot of the whole menu bar so that I can also see the error sign?


this is the last cell number there is.

on all other cells I get this asterisk. However, I have not written any code on the other cells.

UPDATE. I got no error message on the menu bar this time, but still cannot print anything or run any code

If that is the last cell number, it means that the following cell cannot finish running:

This cell tests your exercise 1’s work, do you have any loop inside your compute_entropy function?

P.S. DO NOT share your assignment code.

Ok I have a hint now. When I run the first function, the calculate_entropy, it is like the kernel stops working. After that I can’t run any code on any cell. Then I restart the kernel and rerun everything before the first function and go onto the second function and it works. So I guess there is a problem with me running the first function. If I do not run it everything runs smoothly. However I guess that this function is going to be needed on the next functions.

I probably have a coding mistake. I will try to fix this. Thank you very much.

I suppose by “calculate_entropy”, you are actually talking about “compute_entropy”, right? Again, as I asked you, is there any loop in your “compute_entropy”? Because a loop that does not end can cause the problem you see.

OK. Good luck to you! Let me know here if you can fix it, otherwise, I will close this thread after 12 hours.