0
$\begingroup$

I am currently reading through Music Structure and Analysis from Acoustic Signals and am having some difficulty in understanding how the modified Kullback-Leibler distance is calculated. (I am just very recently starting to get into audio analysis and back into shape regarding more applied math, so this could just be a case of me getting confused by some symbols!)

I'm specifically having some trouble understanding the Segmentation by Clustering section. The formula for the proposed KL distance is:

$$KL2(A, B) = KL(A; B) + KL(B;A)$$

Expanded out, this yields:

$$KL2(A,B) = \left(\frac{\mathrm{Cov}[A]}{\mathrm{Cov}[B]}\right) + \left(\frac{\mathrm{Cov}[B]}{\mathrm{Cov}[A]}\right) + (\mu_A - \mu_B) \cdot \left(\frac{1}{\mathrm{Cov}[A]} + \frac{1}{\mathrm{Cov}[B]}\right)$$

Here's where I'm running into issues:

  1. This formula is expected to be used between to matrices of spectral data. So, basically- how do I compute the covariance? It seems I do it between each feature vector. That's easy enough, but how do I combine them so that they're usable in this formula? It shouldn't be a vector of covariances, right- how could they be divided, then?

  2. Just so I know I'm correct, then the dot product means that the means has to be a vector, right? If that's the case, then what happens if the segments of audio that I'm looking at happen to be different lengths? Will the resulting vector from that subtraction just be the length of the longer vector, with the tail end just being either positive or negative entries based on if A or B had more entries?

Apologies if this is confusing! Any help is appreciated.

$\endgroup$
0
$\begingroup$

The expression in your question seems to have been written for univariate Gaussians. For multivariate Gaussians, $KL(A,B) = \frac{1}{2}\left[\log\frac{|\Sigma_B|}{|\Sigma_A|} - d + Tr(\Sigma_B^{-1}\Sigma_A) + (\mu_B - \mu_A)^T \Sigma_B^{-1}(\mu_B - \mu_A)\right]$ where $d$ is the dimensionality of the feature vectors.

(https://stats.stackexchange.com/questions/60680/kl-divergence-between-two-multivariate-gaussians)

So

\begin{eqnarray*} KL2(A,B) &:=& KL(A,B)+KL(B,A)\\ &=& \frac{1}{2}\left[ - 2d + Tr(\Sigma_B^{-1}\Sigma_A) + Tr(\Sigma_A^{-1}\Sigma_B) + (\mu_B - \mu_A)^T (\Sigma_A^{-1}+\Sigma_B^{-1})(\mu_B - \mu_A)\right]. \end{eqnarray*}

I don't think you compute this for the spectrograms themselves but for feature vectors (some of the features may be derived from the spectrogram).

$\endgroup$
  • $\begingroup$ This was a great answer, thank you! I seem to have figured it out based on what you've posted. $\endgroup$ – SFX Feb 1 '17 at 23:17

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.