In C1_W3_Logistic_Regression, I am encountering difficulties progressing and scoring due to an input restriction error in the code

In the C1_W3_Logistic_Regression section, I am encountering an issue with the provided input protection code, which prevents me from proceeding with the tasks and makes it difficult to complete the grading.

Here is the problematic code:

# load dataset
X_train, y_train = load_data("data/ex2data2.txt")m, n = X_train.shape

# Compute and display cost with w and b initialized to zeros
initial_w = np.zeros(n)
initial_b = 0.
cost = compute_cost(X_train, y_train, initial_w, initial_b)
print('Cost at initial w and b (zeros): {:.3f}'.format(cost))

When executing the above code, the following error message appears:

File "<ipython-input-20-34399ef0bf1b>", line 2
    X_train, y_train = load_data("data/ex2data2.txt")m, n = X_train.shape
                                                     ^
SyntaxError: invalid syntax

Editing is not possible due to input lock. I would like to resolve this issue.

That cell should look like this:

Did you somehow accidentally add the part I’ve underlined here?

First of all, thank you so much for your response.
You are correct, and although I don’t remember exactly, I assume that might have been the case. Aside from that cell, the “%%!” at the end of this cell:

# load dataset
X_train, y_train = load_data("data/ex2data2.txt")%%

also seems to have been unintentionally added. Despite the input lock, it appears to have been added due to some glitch or my keystroke. I would like to fix these issues.

Did you perhaps download the notebook and work on it using some other platform?

You enable editing on that cell.

Instructions are in the"hint" link, all the way at the bottom of the notebook.

No, I have consistently worked within the provided notebook environment and have never downloaded it to work offline. I simply want to completely reset the notebook to its original state. How can I do that? I have already backed up my solutions.

Detailed instructions are here, but the TL;DR is: Rename your notebook, Click Help and then “Get Latest Version”.

1 Like

Thank you so much! Thanks to your help, I was able to successfully submit the assignment and achieve a 100% grade. For reference, during the first reset, as you mentioned, everything was reinitialized. After inputting the solution and submitting it, I encountered glitches where some of the locked, provided code was merged with other code. This acted as an unavoidable challenge for students. I believe this is one of the random errors caused by the Coursera Lab generation system. If Coursera does not address this issue, many students may face similar problems in the future.

Best regards,