6

I came across this documentation in keras for the list of backend functions

One of which was keras.backend.epsilon()

The documentation says that it returns the value of the fuzz factor used in numeric expressions. However I could not understand what fuzz factor is and how is it used in the context of neural networks. Please help me out.

Thanks in advance

numpy
  • 63

1 Answers1

5

The epsilon in Keras is a small floating point number used to generally avoid mistakes like divide by zero. An example of its usage is here in the Keras code for calculation of mean absolute percentage error https://github.com/keras-team/keras/blob/c67adf1765d600737b0606fd3fde48045413dee4/keras/losses.py#L22

from . import backend as K

def mean_absolute_percentage_error(y_true, y_pred):
diff = K.abs((y_true - y_pred) / K.clip(K.abs(y_true),
                                        K.epsilon(),
                                        None))
return 100. * K.mean(diff, axis=-1)
yo_man
  • 196