Why this error in loss function?

Why this error
{mentor edit: code removed}

1 Like

Hi @Ayush_Bhosale,

Please check your code against the formula, it should be the sum of the loss for all the sample data. What you have done here is just a array of all the difference, but has not sum them up to produce a scalar value for the total loss.
As you can see from the error message, your function should return a value of ‘float’ datatype.
To get the sum:
np.sum(abs(y-yhat))

1 Like

thanks

1 Like