# Week1 optional lab: cost function

**URL:** <https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278>\
**Category:** Supervised ML: Regression and Classification\
**Tags:** week-module-1\
**Created:** [September 16, 2022, 1:38pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278 "2022-09-16T13:38:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Kevin](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Alex\_Kevin](https://community.deeplearning.ai/u/Alex_Kevin)\
**Post date:** [September 16, 2022, 1:38pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/1 "2022-09-16T13:38:29Z")

</div>

The code in optional lab runs without a problem.  
But when i copied them and want to run them on Spyder, i was told that:  
ModuleNotFoundError: No module named ‘lab\_utils\_uni’  
So what does that mean? Should I install some Module?

---

<div class="post-metadata">

**Author:** ![Alex\_Kevin](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Alex\_Kevin](https://community.deeplearning.ai/u/Alex_Kevin)\
**Post date:** [September 16, 2022, 1:52pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/2 "2022-09-16T13:52:29Z")

</div>

I downloaded the file which name is:  
[C1\_W1\_Lab04\_Cost\_function\_Soln.ipynb]  
and tried to run it on my Jupyter.  
But it seems there is still a problem:  
No Module named ‘lab\_utils\_uni’  
Does that mean this module was inserted on the optional lab Only?  
Where can i download this module?

---

<div class="post-metadata">

**Author:** ![Eleni\_Lazaridou](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@Eleni\_Lazaridou](https://community.deeplearning.ai/u/Eleni_Lazaridou)\
**Post date:** [September 16, 2022, 3:55pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/3 "2022-09-16T15:55:35Z")

</div>

> [@Alex\_Kevin](#):
>
> lab\_utils\_un

I think you don’t have that file. This file is located on the Jupyter notebook that you open on that link. If you want to run it locally you have to find that file and also copy it on the same folder as the one you are running.

---

<div class="post-metadata">

**Author:** ![rmwkwok](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rmwkwok/32/126977_2.png) [@rmwkwok](https://community.deeplearning.ai/u/rmwkwok)\
**Post date:** [September 17, 2022, 12:44am UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/4 "2022-09-17T00:44:09Z")

</div>

Hello Alex, you can download all files provided by the course for the lab by (1) opening the lab on coursera, (2) click “Lab Files” button on the upper right, (3) click “Download all files”. This is how we can backup the lab.

Raymond

---

<div class="post-metadata">

**Author:** ![Manie\_Kansal](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Manie\_Kansal](https://community.deeplearning.ai/u/Manie_Kansal)\
**Post date:** [February 20, 2023, 6:01pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/5 "2023-02-20T18:01:52Z")

</div>

How to fix this error

---

<div class="post-metadata">

**Author:** ![Manie\_Kansal](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Manie\_Kansal](https://community.deeplearning.ai/u/Manie_Kansal)\
**Post date:** [February 20, 2023, 6:03pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/6 "2023-02-20T18:03:02Z")

</div>

plt.style.use(‘./deeplearning.mplstyle’)  
error on this line as well

---

<div class="post-metadata">

**Author:** ![Manie\_Kansal](https://avatars.discourse-cdn.com/v4/letter/m/c5a1d2/32.png) [@Manie\_Kansal](https://community.deeplearning.ai/u/Manie_Kansal)\
**Post date:** [February 20, 2023, 6:21pm UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/7 "2023-02-20T18:21:24Z")

</div>

“no module utils\_uni”  
installed that lab files… still not working

---

<div class="post-metadata">

**Author:** ![rmwkwok](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rmwkwok/32/126977_2.png) [@rmwkwok](https://community.deeplearning.ai/u/rmwkwok)\
**Post date:** [February 21, 2023, 12:55am UTC](https://community.deeplearning.ai/t/week1-optional-lab-cost-function/205278/8 "2023-02-21T00:55:54Z")

</div>

Hello @Manie_Kansal,

Please [check this out](https://community.deeplearning.ai/t/faq-frequently-asked-questions-for-all-mls-courses/184322/6#when-i-run-my-downloaded-labs-on-my-machine-i-keep-getting-errors-what-can-i-do-19).

Cheers,  
Raymond
