# Problem with the notebook

**URL:** <https://community.deeplearning.ai/t/problem-with-the-notebook/565505>\
**Category:** Neural Networks and Deep Learning\
**Tags:** week-module-2, coursera-platform\
**Created:** [February 5, 2024, 7:28am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505 "2024-02-05T07:28:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gunther\_Joritz](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gunther\_Joritz](https://community.deeplearning.ai/u/Gunther_Joritz)\
**Post date:** [February 5, 2024, 7:28am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/1 "2024-02-05T07:28:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [February 5, 2024, 7:38am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/2 "2024-02-05T07:38:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gunther\_Joritz](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gunther\_Joritz](https://community.deeplearning.ai/u/Gunther_Joritz)\
**Post date:** [February 5, 2024, 7:56am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/3 "2024-02-05T07:56:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [February 5, 2024, 8:06am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/4 "2024-02-05T08:06:45Z")

</div>

> [@Gunther\_Joritz](#):
>
> I know, but it does not solve the problem.

You may try Kernel → Restart & Run All.

---

<div class="post-metadata">

**Author:** ![Gunther\_Joritz](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gunther\_Joritz](https://community.deeplearning.ai/u/Gunther_Joritz)\
**Post date:** [February 5, 2024, 8:32am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/5 "2024-02-05T08:32:26Z")

</div>

It does not solve the problem

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [February 5, 2024, 2:08pm UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/6 "2024-02-05T14:08:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [February 5, 2024, 6:28pm UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/7 "2024-02-05T18:28:14Z")

</div>

> [@Gunther\_Joritz](#):
>
> I have already finshed week 2 with 100 % success with another task.

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?

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [February 5, 2024, 6:29pm UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/8 "2024-02-05T18:29:17Z")

</div>

> [@saifkhanengr](#):
>
> Please share a screenshot of the error you are getting.

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

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [February 5, 2024, 8:37pm UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/9 "2024-02-05T20:37:10Z")

</div>

> [@Gunther\_Joritz](#):
>
> It does not solve the problem

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”.

---

<div class="post-metadata">

**Author:** ![Gunther\_Joritz](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@Gunther\_Joritz](https://community.deeplearning.ai/u/Gunther_Joritz)\
**Post date:** [February 6, 2024, 7:42am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/10 "2024-02-06T07:42:10Z")

</div>

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.

 ![Screenshot 2024-02-06 074954.png](https://global.discourse-cdn.com/dlai/original/3X/b/6/b68085e2bf67e276ba91b71d66dea26e5c4e8873.png)

 ![Screenshot 2024-02-06 082102.png](https://global.discourse-cdn.com/dlai/original/3X/e/9/e91f53559cacd4d835d46c21239fc34a9e121a3d.png)

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [February 6, 2024, 8:17am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/11 "2024-02-06T08:17:41Z")

</div>

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

 ![Capture](https://global.discourse-cdn.com/dlai/original/3X/4/5/45ca85eea715517705946e75aa295afda3a4448b.jpeg)

The only option you have is to get a clean copy as described [here](https://community.deeplearning.ai/t/how-to-get-a-clean-copy-of-an-assignment-notebook/73) and do your code again.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [February 6, 2024, 8:40am UTC](https://community.deeplearning.ai/t/problem-with-the-notebook/565505/12 "2024-02-06T08:40:37Z")

</div>

Please see your personal messages for instructions.
