How to get results from custom loss function in Keras?
问题 I want to implement a custom loss function in Python and It should work like this pseudocode: aux = | Real - Prediction | / Prediction errors = [] if aux <= 0.1: errors.append(0) elif aux > 0.1 & <= 0.15: errors.append(5/3) elif aux > 0.15 & <= 0.2: errors.append(5) else: errors.append(2000) return sum(errors) I started to define the metric like this: def custom_metric(y_true,y_pred): # y_true: res = K.abs((y_true-y_pred) / y_pred, axis = 1) .... But I do not know how to get the value of the