binary_accuracy in keras Metrices , what's the threshold value to predicted one sample as positive and negative cases

jing picture jing · Jan 14, 2017 · Viewed 7k times · Source

What's the threshold value of binary_accuracy in keras Metrices is used to predicted one sample as positive and negative cases? is that threshold value 0.5? how to adjust it? I want to set the threshold value 0.80, if the predicted value is 0.79, then it is considered a negative sample,otherwise,if the predicted value is 0.81, then it is considered a positive sample.

Answer

Avedis picture Avedis · Mar 2, 2017

To answer the initial question, keras uses the round function to assign classes, so the threshold is 0.5.

https://github.com/fchollet/keras/blob/master/keras/metrics.py

def binary_accuracy(y_true, y_pred):
    return K.mean(K.equal(y_true, K.round(y_pred)))