Related to mutual information

조회 수: 1 (최근 30일)
Anamika
Anamika 2014년 1월 23일
댓글: ye song 2017년 3월 1일
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
ye song
ye song 2017년 3월 1일
you should put X&Y

댓글을 달려면 로그인하십시오.

채택된 답변

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