Related to mutual information

2 vues (au cours des 30 derniers jours)
Anamika
Anamika le 23 Jan 2014
Commenté : ye song le 1 Mar 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?
  1 commentaire
ye song
ye song le 1 Mar 2017
you should put X&Y

Connectez-vous pour commenter.

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by