Related to mutual information

2 次查看(过去 30 天)
This is a function for mutual information
function I = MutualInformation(X,Y);
if (size(X,2) > 1) % More than one predictor?
% Axiom of information theory
I = JointEntropy(X) + Entropy(Y) - JointEntropy([X Y]);
else
% Axiom of information theory
I = Entropy(X) + Entropy(Y) - JointEntropy([X Y]);
end
But while running it is showing "not enough input arguements". I am not getting the problem. Can anyone please help me?

采纳的回答

Walter Roberson
Walter Roberson 2014-1-23
You need to go to the command line and call the routine, such as
MutualInformation(rand(5,7), rand(5, 14))
  4 个评论
Anamika
Anamika 2014-1-24
编辑:Walter Roberson 2014-1-24
Thanks a lot sir. I want to explain you one thing. First I have created the function for entropy. The function is shown below-
function h = entropy(vec1)
%=========================================================
%
%This is a prog in the MutualInfo 0.9 package written by
% Hanchuan Peng.
%
%Disclaimer: The author of program is Hanchuan Peng
% at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>.
%
%The CopyRight is reserved by the author.
%
%Last modification: April/19/2002
%
%========================================================
%
% h = entropy(vec1)
% calculate the entropy of a variable vec1
%
% demo:
% a=[1 2 1 2 1]';b=[2 1 2 1 1]';
% fprintf('entropy(a) = %d\n',entropy(a));
%
% the same as entropycond(vec1)
%
% By Hanchuan Peng, April/2002
%
if nargin<1,
disp('Usage: h = entropy(vec1).');
h = -1;
else,
[p1] = estpa(vec1);
h = estentropy(p1);
end;
Next I am generating the joint entropy function as follows-
function h = jointentropy(vec1,vec2)
%=========================================================
%
%This is a prog in the MutualInfo 0.9 package written by
% Hanchuan Peng.
%
%Disclaimer: The author of program is Hanchuan Peng
% at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>.
%
%The CopyRight is reserved by the author.
%
%Last modification: April/19/2002
%
%========================================================
%
% h = jointentropy(vec1,vec2)
% calculate the joint entropy of two variables
%
% when only one variable presents, this function equals entropy(vec1)
%
% demo:
% a=[1 2 1 2 1]';b=[2 1 2 1 1]';
% fprintf('jointentropy(a,b)= %d \n',jointentropy(a,b));
%
% By Hanchuan Peng, April/2002
%
if nargin<1,
disp('Usage: h = condentropy(vec1,<vec2>).');
h = -1;
elseif nargin<2,
[p1] = estpa(vec1);
h = estentropy(p1);
else,
[p12] = estpab(vec1,vec2);
h = estjointentropy(p12);
end;
Next I am doing the above written mutual information function. Now I am writing one different program to call the function as-
clc;
clear all;
close all;
p=MutualInformation(rand(5,4),rand(5,14));
But when I run the program it is showing that "undefined function estpafor character double". Why this problem is creating?
Walter Roberson
Walter Roberson 2014-1-24
The code calls upon the routine named "estpa", but you do not have code for that routine.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by