# C2\_W4\_Assignment\_# UNQ\_C1 GRADED FUNCTION

**URL:** <https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654>\
**Category:** NLP with Probabilistic Models\
**Tags:** week-module-4\
**Created:** [June 4, 2024, 12:22am UTC](https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654 "2024-06-04T00:22:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikhail2](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mikhail2/32/126348_2.png) [@Mikhail2](https://community.deeplearning.ai/u/Mikhail2)\
**Post date:** [June 4, 2024, 12:22am UTC](https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654/1 "2024-06-04T00:22:49Z")

</div>

Good day to all!  
I am asking for help.  
When executing the assignment: “C2\_W4\_Assignment: # UNQ\_C1 GRADED FUNCTION: initialize\_model” test script: “# Test your function  
w4\_unittest.test\_initialize\_model(initialize\_model)” throws an error.

Wrong initialization for W1 matrix. Check the use of the random seed.  
Expected: [[4.17022005e-01 7.20324493e-01 1.14374817e-04 3.02332573e-01  
1.46755891e-01 9.23385948e-02 1.86260211e-01 3.45560727e-01  
3.96767474e-01 5.38816734e-01]  
[4.19194514e-01 6.85219500e-01 2.04452250e-01 8.78117436e-01  
2.73875932e-02 6.70467510e-01 4.17304802e-01 5.58689828e-01  
1.40386939e-01 1.98101489e-01]  
[8.00744569e-01 9.68261576e-01 3.13424178e-01 6.92322616e-01  
8.76389152e-01 8.94606664e-01 8.50442114e-02 3.90547832e-02  
1.69830420e-01 8.78142503e-01]  
[9.83468338e-02 4.21107625e-01 9.57889530e-01 5.33165285e-01  
6.91877114e-01 3.15515631e-01 6.86500928e-01 8.34625672e-01  
1.82882773e-02 7.50144315e-01]]  
Got: [[ 1.62434536 -0.61175641 -0.52817175 -1.07296862 0.86540763 -2.3015387  
1.74481176 -0.7612069 0.3190391 -0.24937038]  
[ 1.46210794 -2.06014071 -0.3224172 -0.38405435 1.13376944 -1.09989127  
-0.17242821 -0.87785842 0.04221375 0.58281521]  
[-1.10061918 1.14472371 0.90159072 0.50249434 0.90085595 -0.68372786  
-0.12289023 -0.93576943 -0.26788808 0.53035547]  
[-0.69166075 -0.39675353 -0.6871727 -0.84520564 -0.67124613 -0.0126646  
-1.11731035 0.2344157 1.65980218 0.74204416]].  
Wrong initialization for W2 matrix. Check the use of the random seed.  
Expected: [[0.98886109 0.74816565 0.28044399 0.78927933]  
[0.10322601 0.44789353 0.9085955 0.29361415]  
[0.28777534 0.13002857 0.01936696 0.67883553]  
[0.21162812 0.26554666 0.49157316 0.05336255]  
[0.57411761 0.14672857 0.58930554 0.69975836]  
[0.10233443 0.41405599 0.69440016 0.41417927]  
[0.04995346 0.53589641 0.66379465 0.51488911]  
[0.94459476 0.58655504 0.90340192 0.1374747]  
[0.13927635 0.80739129 0.39767684 0.1653542]  
[0.92750858 0.34776586 0.7508121 0.72599799]]  
Got: [[-0.19183555 -0.88762896 -0.74715829 1.6924546]  
[0.05080775 -0.63699565 0.19091548 2.10025514]  
[0.12015895 0.61720311 0.30017032 -0.35224985]  
[-1.1425182 -0.34934272 -0.20889423 0.58662319]  
[0.83898341 0.93110208 0.28558733 0.88514116]  
[-0.75439794 1.25286816 0.51292982 -0.29809284]  
[0.48851815 -0.07557171 1.13162939 1.51981682]  
[2.18557541 -1.39649634 -1.44411381 -0.50446586]  
[0.16003707 0.87616892 0.31563495 -2.02220122]  
[-0.30620401 0.82797464 0.23009474 0.76201118]].  
Wrong initialization for b1 vector. Check the use of the random seed.  
Expected: [[0.88330609]  
[0.62367221]  
[0.75094243]  
[0.34889834]]  
Got: [[0.01582124]  
[0.92943723]  
[0.69089692]  
[0.99732285]].  
Wrong initialization for b2 vector. Check the use of the random seed.  
Expected: [[0.26992789]  
[0.89588622]  
[0.42809119]  
[0.96484005]  
[0.6634415]  
[0.62169572]  
[0.11474597]  
[0.94948926]  
[0.44991213]  
[0.57838961]]  
Got: [[0.17234051]  
[0.13713575]  
[0.93259546]  
[0.69681816]  
[0.06600017]  
[0.75546305]  
[0.75387619]  
[0.92302454]  
[0.71152476]  
[0.12427096]].  
Wrong initialization for W1 matrix. Check the use of the random seed.  
Expected: [[4.17022005e-01 7.20324493e-01 1.14374817e-04]  
[3.02332573e-01 1.46755891e-01 9.23385948e-02]]  
Got: [[1.62434536 -0.61175641 -0.52817175]  
[-1.07296862 0.86540763 -2.3015387]].  
Wrong initialization for W2 matrix. Check the use of the random seed.  
Expected: [[0.18626021 0.34556073]  
[0.39676747 0.53881673]  
[0.41919451 0.6852195]]  
Got: [[1.74481176 -0.7612069]  
[0.3190391 -0.24937038]  
[1.46210794 -2.06014071]].  
Wrong initialization for b1 vector. Check the use of the random seed.  
Expected: [[0.20445225]  
[0.87811744]]  
Got: [[0.14038694]  
[0.19810149]].  
Wrong initialization for b2 vector. Check the use of the random seed.  
Expected: [[0.02738759]  
[0.67046751]  
[0.4173048]]  
Got: [[0.80074457]  
[0.96826158]  
[0.31342418]].  
Wrong initialization for W1 matrix. Check the use of the random seed.  
Expected: [[0.22199317 0.87073231 0.20671916 0.91861091 0.48841119]  
[0.61174386 0.76590786 0.51841799 0.2968005 0.18772123]  
[0.08074127 0.7384403 0.44130922 0.15830987 0.87993703]]  
Got: [[0.44122749 -0.33087015 2.43077119 -0.25209213 0.10960984]  
[1.58248112 -0.9092324 -0.59163666 0.18760323 -0.32986996]  
[-1.19276461 -0.20487651 -0.35882895 0.6034716 -1.66478853]].  
Wrong initialization for W2 matrix. Check the use of the random seed.  
Expected: [[0.27408646 0.41423502 0.29607993]  
[0.62878791 0.57983781 0.5999292]  
[0.26581912 0.28468588 0.25358821]  
[0.32756395 0.1441643 0.16561286]  
[0.96393053 0.96022672 0.18841466]]  
Got: [[-0.70017904 1.15139101 1.85733101]  
[-1.51117956 0.64484751 -0.98060789]  
[-0.85685315 -0.87187918 -0.42250793]  
[0.99643983 0.71242127 0.05914424]  
[-0.36331088 0.00328884 -0.10593044]].  
Wrong initialization for b1 vector. Check the use of the random seed.  
Expected: [[0.02430656]  
[0.20455555]  
[0.69984361]]  
Got: [[0.63979518]  
[0.9856244]  
[0.2590976]].  
Wrong initialization for b2 vector. Check the use of the random seed.  
Expected: [[0.77951459]  
[0.02293309]  
[0.57766286]  
[0.00164217]  
[0.51547261]]  
Got: [[0.80249689]  
[0.87048309]  
[0.92274961]  
[0.00221421]  
[0.46948837]].  
24 Tests passed  
12 Tests failed

Based on the results obtained, the code was implemented without errors:

![image](https://global.discourse-cdn.com/dlai/original/3X/0/7/078714fe7970a4ae85b5b2ec5b3b7427954341d9.png)

Please tell me where the mistake was made?

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [June 4, 2024, 1:49am UTC](https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654/2 "2024-06-04T01:49:10Z")

</div>

did you use the correct random seed? your error seems to point out in that direction

---

<div class="post-metadata">

**Author:** ![Mikhail2](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/mikhail2/32/126348_2.png) [@Mikhail2](https://community.deeplearning.ai/u/Mikhail2)\
**Post date:** [June 5, 2024, 12:51am UTC](https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654/3 "2024-06-05T00:51:54Z")

</div>

I used the parameter given in the task and did not change it.

![image](https://global.discourse-cdn.com/dlai/original/3X/9/a/9a87c0af40dbf5b9dd94beb738ea7a132283ebf0.png)

The terms of the assignment indicate that it should not be changed.

![image](https://global.discourse-cdn.com/dlai/original/3X/c/6/c67b6f178c43e542dcc1983cbb272103f286e801.png)

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [June 5, 2024, 2:44am UTC](https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654/4 "2024-06-05T02:44:58Z")

</div>

please send a screenshot of your grade cell codes by personal DM.

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/165831_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [June 9, 2024, 2:12pm UTC](https://community.deeplearning.ai/t/c2-w4-assignment-unq-c1-graded-function/640654/5 "2024-06-09T14:12:56Z")

</div>

Your C1 Codes seems to be correct. Kindly send screenshot of C2, C3 and C4 codes via personal DM.
