Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There might be a bug in jtree_inf_engine and var_elim_inf_engine #42

Closed
yzhang2016 opened this issue Apr 6, 2016 · 0 comments
Closed

Comments

@yzhang2016
Copy link

yzhang2016 commented Apr 6, 2016

Hi,

I am not sure whether it is a bug in junction tree inference and variable elimination.

For the following BN model, when computing marginal for each node given node 1, I have tested Junction tree inference , variable elimination and pear_inf_engine. I found that the results by Junction tree and variable elimination are incorrect while pear_inf_engine is correct. I have no idea what happens in the Junition tree and the variable elimination engine .

I compute the marginal given node 1 for each other node manually. For node 8 and node 9, only pearl_infer_engine gets the right results.

I put the learned bnet model (matlab format) in the attachment.
Model configuration :

  • all nodes are discrete
  • node 1 has 8 states and others are binary

image

## Results : P(A8 = 2 | A1) P(A9 = 2 | A1)
Result : jtree
image

Result : var_elim
image

Result : pearl
image

## *Manual *:
image

code
--------------------------- 
jtree_Engine = jtree_inf_engine(bnet) ;
var_Engine = var_elim_inf_engine(bnet) ;
pearl_Engine = pearl_inf_engine(bnet) ;

jtree_conMarg = compMarginal (bnet,jtree_Engine) ;
var_conMarg_ = compMarginal (bnet,var_Engine) ;
pearl_conMarg_ = compMarginal (bnet,pearl_Engine) ;


function [conMarg] = compMarginal (bnet,engine)
%% First node : exp, 8 states, others : AUs, binary
numNodes = size(bnet.dag,1) ;
numAUs = numNodes - 1;
numCls = bnet.node_sizes(1) ;
evidence = cell(1,numNodes) ;
conMarg = zeros(numCls,numAUs) ;
for i = 1 : numCls
evidence{1} = i ;
engine = enter_evidence(engine,evidence) ;
for j = 1 : numAUs
temNodeInd = j + 1 ;
temMarg = marginal_nodes(engine,temNodeInd) ;
conMarg(i,j) = temMarg.T(2) ;
end
end

bnet_learnedModel.zip

@yzhang2016 yzhang2016 changed the title There might a bug in jtree_inf_engine and var_elim_inf_engine There might be a bug in jtree_inf_engine and var_elim_inf_engine Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant