My regression should predict values >=0 But a wrongly predicted value >0(e.g. 0.001 instead of 0) is much worse then a a slight missprediction of 0.001 (e.g. 0.002 instead of 0.003)
I am thinking about a costume loss function that weights the false non zeros to return a big loss.
Is there a more elegant way ?
Edit:
this is my unelegant sollution:
def custom_loss(y,yh):
if y == 0:
loss = tf.math.minimum(100,yt*100000)
else :
loss = losses.mean_squared_error(yh,y)
return loss