?? #klgauss.m#
字號:
function kl = KLgauss(P, Q)%The following computes D(P||Q), the KL divergence between two zero-mean%Gaussians with covariance P and Q:% klDiv = -0.5*(log(det(P*inv(Q))) + trace(eye(N)-P*inv(Q)));R = P*inv(Q);kl = -0.5*(log(det(R))) + trace(eye(length(P))-R);To get MI, just set P=cov(X,Y) and Q=blockdiag(cov(X),cov(Y)). The formulawith differing means is not much more complicated, but I don't have code for itand can't remember the formula at the moment.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -