i\'ve tried to use the codes given from Keras before they\'re removed. Here\'s the code :
def precision(y_true, y_pred):
true_positives = K.sum(K.round(K
Using a Keras metric function is not the right way to calculate F1 or AUC or something like that.
The reason for this is that the metric function is called at each batch step at validation. That way the Keras system calculates an average on the batch results. And that is not the right F1 score.
Thats the reason why F1 score got removed from the metric functions in keras. See here:
The right way to do this is to use a custom callback function in a way like this: