Hi.

I am solving the assignments but it seems there is problem.

In block number [20] the exercise has two calls to a function that calculates a loss function.

In line number 3 it calls function L1, and it works as expected.

But in line 5 it calls function named L1_test, that is not defined - and an error is raised.

Could you help me with this problem ?

Kind regards.

```
Code deleted by mentor
```

Hello @leandro.cardinal_San
Run the code cell where you have the function ‘L1_test’ and check

Hey @leandro.cardinal_San ,

I have deleted your screenshot as it contains graded code which is against our community guideline to share it.

Please follow @jenitta.jebaraj ’s steps and take another screenshot which shows your error message only

Regards,
Jamal

Hello,

Please , look the new screenshot. It does not contain any graded code.

Notice that function “L1” is correctly defined … but the function “L1_test” is not defined and the run-time error runs.

Regards

TMosh
November 21, 2023, 5:21pm
5
I don’t see anything in your latest screen capture image that says L1_test is not defined.

Instead, what I see is that the L1_test() runs, and your code doesn’t pass one of its tests.

Yes, you got the test to run and now what it’s telling you is that your code is not correct. It generates the wrong answer. Have another look at the math formula for the L1 loss. Note that taking the absolute value of the sum is not the same thing as taking the sum of the absolute values.

TMosh
November 21, 2023, 5:24pm
7
I recommend you check again if your code for computing the “loss” variable is mathematically correct.

On top of what @paulinpaloalto and @TMosh said.
Here is the formula so that you can check it again too:

TMosh
November 21, 2023, 5:51pm
9
Note: Those vertical bars are not parenthesis or brackets. They’re the absolute value operator.