2

I am trying to understand a certain KL-divergence formula (which can be found on page 6 of the paper Evidential Deep Learning to Quantify Classification Uncertainty) and found a TensorFlow implementation for it. I understand most parts of the formula and put colored frames around them. Unfortunately, there is one term in the implementation (underlined red) that I can't tell how it fits in the formula.

tensorflow implementation of KL divergence

Is this a mistake in the implementation? I don't understand how the red part is necessary.

nbro
  • 39,006
  • 12
  • 98
  • 176
Baka
  • 33
  • 3

1 Answers1

1

It should remain from a general code that has been refactored. By the way, the red code phrase is always zero. Because, beta is a vector of 1, and $\log(\Gamma(1)) = \log(1) = 0$, i.e., tf.math.lgamma(beta). So, sum of zeros will be zero.

As you said, the other parts of the code are clear and completely matched with the definition.

OmG
  • 1,731
  • 10
  • 19
  • Thank you, you are right. I was worried because I found this code multiple times on the internet, but it seems everyone copied from the same source. – Baka Aug 08 '21 at 08:07