How do you compute accuracy in a regression model, after rounding predictions to classes, in keras?

后端 未结 2 797
再見小時候
再見小時候 2021-01-02 18:59

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

2条回答
  •  死守一世寂寞
    2021-01-02 19:33

    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])
    

提交回复
热议问题