我的主管已经为我设置了一个示例练习,我完全不知道我应该去哪里。
我的任务是生成两个近似高斯 PDF 的直方图。然后,我打算改变直方图的均值,使它们在某种程度上重叠,然后计算互信息的下降。
我尝试了多种解决方案,但到目前为止没有一个给我可靠的结果。我现在要做的是计算每个直方图的熵,然后减去联合直方图的熵。然而,即使这样也变得困难。
现在,我正在使用以下代码;
clear all
%Set the number of points and the number of bins;
points = 1000;
bins = 5;
%Set the probability of each stimulus occurring;
p_s1 = 0.5;
p_s2 = 0.5;
%Set the means and variance of the histogram approximations;
mu1 = 5;
mu2 = 8.2895;
sigma1 = 1;
sigma2 = 1;
%Set up the histograms;
randpoints1 = sigma1.*randn(1, points) + mu1;
randpoints2 = sigma2.*randn(1, points) + mu2;
[co1, ce1] = hist(randpoints1, bins);
[co2, ce2] = hist(randpoints2, bins);
%Determine the marginal histogram;
[hist2D, binC] = hist3([randpoints1', randpoints2'], [bins, bins]);
prob2D = hist2D/points;
r_s1 = sum(prob2D, 2)'; %leftmost histogram
r_s2 = sum(prob2D, 1); %rightmost histogram
%Determine p(r) for each of the marginal histograms;
r1 = p_s1*r_s1;
r2 = p_s2*r_s2;
%Determine the mutual information for each of the marginal histograms;
for ii = 1:bins;
minf1(ii) = p_s1*r_s1(ii)*log2((r_s1(ii))/(r1(ii)));
minf2(ii) = p_s2*r_s2(ii)*log2((r_s2(ii))/(r2(ii)));
end
minf1(isnan(minf1)) = 0;
minf2(isnan(minf2)) = 0;
Imax = sum(minf1) + sum(minf2);
根据我对信息论的理解(尽管有限),上面应该计算了第一个和第二个直方图中“包含”的信息,并将它们相加。我希望这个总和的值为 1,而且我确实达到了这个值。但是,我现在坚持的是确定联合直方图,然后是要减去的联合熵。
prob2D我创建的矩阵是联合概率吗?如果是这样,我该如何使用它?任何见解或相关论文的链接将不胜感激 - 我一直在谷歌搜索,但我无法找到任何有价值的东西。


