Can somebody tell me what is the right code for loss function? I can’t find mistake in mine
If you see the formula then you will get to know that we are doing the sum of absolute of difference of y and yhat. So, you also need to use np.abs() to get the correct result.
were you able to get the correct results?
using abs.yhat and abs.y also doest yield correct resuly.
please share the correct approach. thanx
It looks as though this thread does not belong in Course 1. To the the best of my recollection, the L1 metric (“Manhattan” distance) does not come up there. Please repost in the proper course. Course 2? Descriptive topic titles are also useful. For example: Week 3, Exercise 5, Loss function.
Also, you need to refrain from posting your code in any public forum. It’s against the rules. Please limit yourself to screenshots of the traceback (the error messages).
Thanks!
Ken B
Hi thanks for feedback.
This is from Course 1 Week 2 practice programming assignment. The loss(l1) result showed as incorrect when np.sum is used including abs function. can you share the correct approach?