# Tag Info

13

When it comes to a classification problem in machine learning, the cross-entropy and the KL divergence are equal. As already stated in the question, the general formula is this: $$H(p, q) = H(p) + D_{KL}(p \parallel q),$$ where $p$ is the "true"/target distribution and $q$ is an estimated distribution, $H(p, q)$ is the cross-entropy, $H(p)$ is the ...

5

Given that policies are probability distributions, in principle, you can use any metric or measure of distance that can be used to compare two probability distributions. (Note that notions of distance are not necessarily metrics in a mathematical sense). A common measure is the Kullback–Leibler divergence (which is not a metric, in a mathematical sense, ...

5

In variational inference, the original objective is to minimize the Kullback-Leibler divergence between the variational distribution, $q(z \mid x)$, and the posterior, $p(z \mid x) = \frac{p(x, z)}{\int_z p(x, z)}$, given that the posterior can be difficult to directly infer with the Bayes rule, due to the denominator term, which can contain an intractable ...

5

This is the analytical form of the KL divergence between two multivariate Gaussian densities with diagonal covariance matrices (i.e. we assume independence). More precisely, it's the KL divergence between the variational distribution  q_{\boldsymbol{\phi}}(\mathbf{z}) = \mathcal{N}\left(\mathbf{z} ; \boldsymbol{\mu}, \mathbf{\Sigma} = \boldsymbol{\sigma}^...

4

The code is correct. Since OP asked for a proof, one follows. The usage in the code is straightforward if you observe that the authors are using the symbols unconventionally: sigma is the natural logarithm of the variance, where usually a normal distribution is characterized in terms of a mean $\mu$ and variance. Some of the functions in OP's link even have ...

3

You can know it better, if you know the concept of entropy: Information entropy is the average rate at which information is produced by a stochastic source of data. The information content (also called the surprisal) of an event $E$ is an increasing function of the reciprocal of the $p(E)$ of the event, precisely ${\... 2 I don't have a definite answer, but only a suspicion/idea: Looking at Figure 1 from the WGAN paper, we clear see that the JS divergence on the right is not continuous at$0$, hence not differentiable at$0$. However, the EM plot on the left is continuous also at$0$. You could now argue that we have a kink there, so it should not be differentiable there ... 2 To add to nbro's answer, I'd say also that much of the time the distance measure isn't simply a design decision, rather it comes up naturally from the model of the problem. For instance, minimizing the KL divergence between your policy and the softmax of the Q values at a given state is equivalent to policy optimization where the optimality at a given state ... 2 This question is very general in the sense that the reason may differ depending on the area of ML you are considering. Below are two different areas of ML where the KL-divergence is a natural consequence: Classification: maximizing the log-likelihood (or minimizing the negative log-likelihood) is equivalent to minimizing KL divergence as typical used in DL-... 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. 1 Your three dimensional latent representation consists of two images of mean pixels and covariance pixels as shown in Fig. 3. Which represents a Gaussian distribution with the mean and covariance for each pixel in the latent representation. Each pixel value is a random variable. Now, have a close look at KL-loss Eq. 3 and it's corresponding description in the ... 1 In ML we always deal with unknown probability distributions from which the data comes. The most common way to calculate the distance between real and model distribution is$KL$divergence. Why Kullback–Leibler divergence? Although there are other loss functions (e.g. MSE, MAE),$KL$divergence is natural when we are dealing with probability distributions. It ... 1 Ans 1. The motive of Variational Inference(on which VAE is based), is to decrease$KL(q(z|x)||p(z))$, where p(z) is our chosen distribution of the hidden variable z. After doing some math, we can write this expression as-$ KL(q||x) = log(p(x)) - \Sigma_z q(z)log(\frac{p(x,z)}{q(z)}) $For a given x, the first term of RHS is constant. So we maximise the ... 1 I did not read those two specified linked/cited papers and I am not currently familiar with the total variation distance, but I think I can answer some of your questions, given that I am reasonably familiar with the KL divergence. When you compute the$D_{KL}\$ between two polices, what does that tell you about them The KL divergence is a measure of "...

Only top voted, non community-wiki answers of a minimum length are eligible