function [Ixy,lambda]=MutualInfo(X,Y)
%%
% Estimating Mutual Information with Moon et al. 1995
% between X and Y
% Input parameter
% X and Y : data column vectors (nL*1, nL is the record length)
%
% Output
% Ixy : Mutual Information
% lambda: scaled mutual information similar comparabble to
% cross-correlation coefficient
%
% Programmed by
% Taesam Lee, Ph.D., Research Associate
% INRS-ETE, Quebecc
% Hydrologist
% Oct. 2010
%
%
X=X';
Y=Y';
d=2;
nx=length(X);
hx=(4/(d+2))^(1/(d+4))*nx^(-1/(d+4));
Xall=[X;Y];
sum1=0;
for is=1:nx
pxy=p_mkde([X(is),Y(is)]',Xall,hx);
px=p_mkde([X(is)],X,hx);
py=p_mkde([Y(is)],Y,hx);
sum1=sum1+log(pxy/(px*py));
end
Ixy=sum1/nx;
lambda=sqrt(1-exp(-2*Ixy));
%% Multivariate kernel density estimate using a normal kernel
% with the same h
% input data X : dim * number of records
% x : the data point in order to estimate mkde (d*1) vector
% h : smoothing parameter
function [pxy]=p_mkde(x,X,h);
s1=size(X);
d=s1(1);
N=s1(2);
Sxy=cov(X');
sum=0;
%p1=1/sqrt((2*pi)^d*det(Sxy))*1/(N*h^d);
% invS=inv(Sxy);
detS=det(Sxy);
for ix=1:N
p2=(x-X(:,ix))'*(Sxy^(-1))*(x-X(:,ix));
sum=sum+1/sqrt((2*pi)^d*detS)*exp(-p2/(2*h^2));
end
pxy=1/(N*h^d)*sum;
%% Reference
% Moon, Y. I., B. Rajagopalan, and U. Lall (1995),
% Estimation of Mutual Information Using Kernel Density Estimators,
% Phys Rev E, 52(3), 2318-2321.
MutualInfo.zip_mutual information_mutualinfo_互信息_互信息的计算_计算互信息
版权申诉
5星 · 超过95%的资源 19 浏览量
2022-07-15
18:20:28
上传
评论 1
收藏 976B ZIP 举报
JaniceLu
- 粉丝: 78
- 资源: 1万+
最新资源
- yolo目标检测项目实验
- downloadFile-1.hc
- Centos7.9环境下离线安装开源版Nginx(亲测版)
- C++课程设计:基于Qt的航班信息管理系统
- ADS7822UVerilog驱动,前面传的有点问题
- 基于python的高性能爬虫程序,使用了多线程+缓存+xpath实现的,这里以彼-岸图库为例,实现,仅用于学习交流
- 中分辨率成像光谱仪(MODIS)烧毁面积产品信息MODIS-C6-BA-User-Guide-1.2.pdf
- Screenshot_20240427_172613_com.huawei.browser.jpg
- 关于学习Python的相关资源网站链接及相关介绍.docx
- (HAL库)基于STM32F103C8T6的温控PID系统[Dht11、ESP8266、无线透传、L298N……]
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈