Related to mutual information

2 ビュー (過去 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 Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by