How would you create and display an accuracy metric in keras for a regression problem, for example after you round the predictions to the nearest integer class?
Whi
The answer by Thomas pretty much sums up the question. Just a minor addition as I was stuck in this one. Here "K" is
import keras.backend as K
def soft_acc(y_true, y_pred):
return K.mean(K.equal(K.round(y_true), K.round(y_pred)))
model.compile(..., metrics=[soft_acc])
I use rounded accuracy like this:
def soft_acc(y_true, y_pred):
return K.mean(K.equal(K.round(y_true), K.round(y_pred)))
model.compile(..., metrics=[soft_acc])