Related to mutual information

2 visualizaciones (últimos 30 días)
Anamika
Anamika el 23 de En. de 2014
Comentada: ye song el 1 de Mzo. de 2017
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de En. de 2014
You need to go to the command line and call the routine, such as
MutualInformation(rand(5,7), rand(5, 14))
  4 comentarios
Anamika
Anamika el 24 de En. de 2014
Editada: Walter Roberson el 24 de En. de 2014
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 el 24 de En. de 2014
The code calls upon the routine named "estpa", but you do not have code for that routine.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by