mutual_info_score.m.svn-base
来自「bayesian network structrue learning mat」· SVN-BASE 代码 · 共 26 行
SVN-BASE
26 行
function score = mutual_info_score(i,si,j,sj,data)
% G = mutual_info_score(i,si,j,sj,data)
% Only for tabular node which values are 1,2,...,size .
% si is size of node i, sj is size of node j.
% data(i,m) is the node i in the case m.
%
% Ref :
% C. Chow and C. Liu (1968). Approximating discrete probability distributions with dependence trees.
% IEEE Transactions on Information Theory, 14(3):462--467, May 1968.
%
% olivier.francois@insa-rouen.fr, philippe.leray@insa-rouen.fr, wangxiangyang@sjtu.edu.cn
[n N]=size(data);
Nj=hist(data(j,:),1:sj);
Ni=hist(data(i,:),1:si);
NiNj=Ni'*Nj;
for k=1:si
ind=find(data(i,:)==k) ;
Nij(k,:) = hist(data(j,ind),1:sj);
end
% sommons les valeurs non-infinies:
ind=find(NiNj~=0 & Nij~=0);
score=sum(sum(Nij(ind).*log(N*Nij(ind)./NiNj(ind))/N));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?