# Dls course 2 week 2

**URL:** <https://community.deeplearning.ai/t/dls-course-2-week-2/295915>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** coursera-platform\
**Created:** [March 24, 2023, 2:29pm UTC](https://community.deeplearning.ai/t/dls-course-2-week-2/295915 "2023-03-24T14:29:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sudipta\_Mukherjee1](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sudipta\_Mukherjee1](https://community.deeplearning.ai/u/Sudipta_Mukherjee1)\
**Post date:** [March 24, 2023, 2:29pm UTC](https://community.deeplearning.ai/t/dls-course-2-week-2/295915/1 "2023-03-24T14:29:14Z")

</div>

unable to solve optimization methods please help anyone

 ![Screenshot (67)](https://global.discourse-cdn.com/dlai/original/3X/2/5/251cf29aabfed4ded2955858a604889ca0c1bd0c.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:** [March 24, 2023, 2:41pm UTC](https://community.deeplearning.ai/t/dls-course-2-week-2/295915/2 "2023-03-24T14:41:36Z")

</div>

Hello @Sudipta_Mukherjee1!  
With the test case, we don’t have W3 but your code gives that KeyError. We have given that:

```auto
for l in range(1, L + 1):
# (approx. 2 lines)
# parameters["W" + str(l)] =  
# parameters["b" + str(l)] =     

```

Now think about it. Range is starting from 1, not 0, `range(1, L + 1)`. So, do we need to call w or b by l or l+1?

Best,  
Saif.

---

<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:** [March 24, 2023, 2:44pm UTC](https://community.deeplearning.ai/t/dls-course-2-week-2/295915/3 "2023-03-24T14:44:10Z")

</div>

Another hint can be found in the below image.

 ![Capture](https://global.discourse-cdn.com/dlai/original/3X/9/4/949a39d16f2c8725defe1e7d8ff5cba45e89e797.jpeg)

---

<div class="post-metadata">

**Author:** ![Sudipta\_Mukherjee1](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@Sudipta\_Mukherjee1](https://community.deeplearning.ai/u/Sudipta_Mukherjee1)\
**Post date:** [March 24, 2023, 3:20pm UTC](https://community.deeplearning.ai/t/dls-course-2-week-2/295915/4 "2023-03-24T15:20:39Z")

</div>

ok i solved it but now another syntax error occured please help

 ![Screenshot (68)](https://global.discourse-cdn.com/dlai/original/3X/e/1/e160c5910210d3bfd973e3eeef9c529338e08524.png)

---

<div class="post-metadata">

**Author:** ![Elemento](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/elemento/32/854_2.png) [@Elemento](https://community.deeplearning.ai/u/Elemento)\
**Post date:** [March 24, 2023, 4:41pm UTC](https://community.deeplearning.ai/t/dls-course-2-week-2/295915/5 "2023-03-24T16:41:38Z")

</div>

Hey @Sudipta_Mukherjee1,  
Can you please DM me your implementation for the `update_parameters_with_adam` function?

Cheers,  
Elemento
