5

I am computing Recall and Accuracy for my model and I am wondering why people add Keras.epsilon() to their variables (examples found on stackoverflow : Macro metrics (recall/F1...) for multiclass CNN or How to calculate F1 Macro in Keras? )

Thank you very much for your answer !

Kindly

chalbiophysics
  • 313
  • 4
  • 15

2 Answers2

15

When there's a division operation taking place, it's often added to the denominator to prevent a divide by zero error. Epsilon is small value (1e-07 in TensorFlow Core v2.2.0) that makes very little difference to the value of the denominator, but ensures that it isn't equal to exactly zero.

k-venkatesan
  • 655
  • 1
  • 8
  • 15
0

epsilon: A small constant for numerical stability. This epsilon is "epsilon hat" in the Kingma and Ba paper (in the formula just before Section 2.1), not the epsilon in Algorithm 1 of the paper. Defaults to 1e-7 Source= Click here

Engr Ali
  • 409
  • 1
  • 5
  • 13