'How can I define custom geometric mean evaluation metrics in tensorflow 2.0?

How can implement the following imblearn geometric mean in Tensorflow to compile LSTM model?

from imblearn.metrics import geometric_mean_score
gmean = geometric_mean_score(yTest,yPred)

I wanted to use the following option, but it is not working like metrics=[keras.metrics.AUC(name='auc')]

from keras import backend 
def gmean(y_true, y_pred):
    return backend.geometric_mean_score(yTest,yPred)

I tried this Available StackOverflow suggestions , but it didn't work as well.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source