2
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – Baka
    Aug 8 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.