# W3\_A1 nn\_model() same cost value

**URL:** <https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363>\
**Category:** Neural Networks and Deep Learning\
**Tags:** week-module-3, coursera-platform\
**Created:** [April 9, 2024, 7:55pm UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363 "2024-04-09T19:55:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ishan\_Maduranga](https://avatars.discourse-cdn.com/v4/letter/i/4af34b/32.png) [@Ishan\_Maduranga](https://community.deeplearning.ai/u/Ishan_Maduranga)\
**Post date:** [April 9, 2024, 7:55pm UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363/1 "2024-04-09T19:55:58Z")

</div>

![image](https://global.discourse-cdn.com/dlai/original/3X/4/1/41eb017676102f578bcb943510e51ff7630a57aa.png)  
Hello I am Ishan  
Week 3 Assignment 1 Cost does not change in nn\_model() function.Can anyone help me to fix the issue?

---

<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:** [April 9, 2024, 8:39pm UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363/2 "2024-04-09T20:39:31Z")

</div>

If the cost never decreases, there are a few possiblities:

- Does your backward\_propagation() function work correctly and pass all its  
tests? If the gradients are wrong, there won’t be any learning, and the cost will never change.

- Does your update\_parameters() function work correctly? If the gradients aren’t applied to the weights correctly, then there won’t be any learning, and the cost will never change.

- Does your nn\_model() function call the forward\_propagation(), compute\_cost(), backward\_propagation(), and update\_parameters() functions correctly, and pass all of its tests?

- Do any of your functions wrongly re-initialize the weights to zero?

---

<div class="post-metadata">

**Author:** ![Ishan\_Maduranga](https://avatars.discourse-cdn.com/v4/letter/i/4af34b/32.png) [@Ishan\_Maduranga](https://community.deeplearning.ai/u/Ishan_Maduranga)\
**Post date:** [April 10, 2024, 1:33am UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363/3 "2024-04-10T01:33:52Z")

</div>

All the test cases of the previous exercises passed.  
I checked all the functions but i couldn’t find a mistake…

---

<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:** [April 10, 2024, 1:51am UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363/4 "2024-04-10T01:51:06Z")

</div>

Passing the test cases does not prove your code is perfect.

---

<div class="post-metadata">

**Author:** ![Ishan\_Maduranga](https://avatars.discourse-cdn.com/v4/letter/i/4af34b/32.png) [@Ishan\_Maduranga](https://community.deeplearning.ai/u/Ishan_Maduranga)\
**Post date:** [April 10, 2024, 2:04am UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363/5 "2024-04-10T02:04:08Z")

</div>

I have been struggling for hours by changing the functions also nothing could help me to fix the issue

---

<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:** [April 10, 2024, 2:39am UTC](https://community.deeplearning.ai/t/w3-a1-nn-model-same-cost-value/607363/7 "2024-04-10T02:39:15Z")

</div>

For those who find this thread later:

The issue was a typo in the “parameters” variable name in nn\_model().
