Problem with the notebook

I got the error message :The following cell failed:

w = np.array([[0.1124579], [0.23106775]])
b = -0.3
X = np.array([[1., -1.1, -3.2],[1.2, 2., 0.1]])
print ("predictions = " + str(predict(w, b, X)))

predict_test(predict)

The error was:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-18-2cb6511f8fa3> in <module>
      2 b = -0.3
      3 X = np.array([[1., -1.1, -3.2],[1.2, 2., 0.1]])
----> 4 print ("predictions = " + str(predict(w, b, X)))
      5 
      6 predict_test(predict)

NameError: name 'predict' is not defined

In the Exercise 7 -
I have the # GRADED FUNCTION: optimize
So i Can not solve this.

And I have already finshed week 2 with 100 % success with another task.

Every time you open the notebook, you have to run all of the cells starting from the top. That is how the workspace is configured and all of your functions are prepared for use.

Moin,

I know, but it does not solve the problem.

In the Exercise 7 – predict.

I always get the # GRADED FUNCTION: optimize

So i Can not solve this.

And I have already finshed week 2 with 100 % success with another task.

Best regards

Günther

You may try Kernel → Restart & Run All.

It does not solve the problem

Please share a screenshot of the error you are getting. Also, make sure you are running your notebook on Coursera Environment, not on your local environment.

I’m not sure what information we are to understand from this statement. If you have 100% on Week 2, what is your question about? What “another task” are you referring to?

Yes, this will be very helpful in understanding the issue. Please include the entire context of the error message.

I’m in the same position as Tom and Saif: I don’t really understand what your error looks like. But here’s one guess: if after rerunning the whole notebook you still get “predict not defined” then maybe you accidentally converted the function cell for predict from a code cell into a markdown (documentation) cell. There is a menu item “Cell → Cell type” that you can use to check and also switch it back if it shows as “Markdown”.

Moin,

here are two screenshots.

  • Exercise 7 is about predict, but the Graded Function is optimize.

  • Ln [36] need prediction, but the Graded function is about optimize.

I’m frustrated with the second week.

I started this test in January. After a few days this test was gone and I had to start another test again. I passed the test with 100% success. Now this test is gone and the old test is back. But I can’t get any further here.

Oh! It seems you have deleted that cell (by mistake). Here what I see in my Notebook:

The only option you have is to get a clean copy as described here and do your code again.

Please see your personal messages for instructions.