C2W2 Getting Error train_x not defined

In the trainig cell: # train 3-layer model I get the following error:

NameError Traceback (most recent call last)

  •  1 # train 3-layer model*

----> 2 layers_dims = [train_X.shape[0], 5, 2, 1]

  •  3 parameters = model(train_X, train_Y, layers_dims, optimizer = "gd", learning_rate = 0.1, num_epochs=5000, decay=update_lr)*
  •  4 *
  •  5 # Predict*

NameError: name ‘train_X’ is not defined

Does someone know how to fix this?

Ok starting the notebook from the previous assignment solved that problem

Whenever you open a notebook, you always need to run all of the cells starting from the top.
That’s how the packages are imported and the environment is initialized.

Yes I tried that, even restarted the kernel, and ran all cells, but still had that issue

Then it might be possible that you have deleted/modified some line of code or cell. Please get a clean copy of your assignment, as described here, and do your code again without changing/deleting the pre-written code and comments.

Here’s the code, which was given to you in the template of the notebook, which creates train_X:

So did you modify that code? Or perhaps you accidentally converted that cell from “code” to “markdown”?

It seems that I somehow edited cells that I shouldn’t. Getting a clean copy worked.