Personal tools
You are here: Home Discussion

Discussion

Up to the Bugs Forum
Please feel free to communicate anything you feel could help this project move on. You can receive an email each time a new message is posted by setting up your personal preferences.

Error during learning using MCMCEngine

Posted by obadmin at November 04. 2006
Hi,

I am trying to learn the parameters for the following test BN using
OpenBaye:

$python2.4 bayesian_network_test.py
BNet Test Bayesian Network
Vertices:
hod (discrete, 24)
b (discrete, 5)
os (discrete, 4)
top (discrete, 7)
ur (discrete, 5)
r (discrete, 5)
cr (discrete, 5)
c1 (discrete, 15)
dr (discrete, 5)
dow (discrete, 7)

Edges:
0: dow (discrete, 7) -> c1 (discrete, 15)
1: hod (discrete, 24) -> c1 (discrete, 15)
2: r (discrete, 5) -> c1 (discrete, 15)
3: cr (discrete, 5) -> c1 (discrete, 15)
4: dr (discrete, 5) -> c1 (discrete, 15)
5: ur (discrete, 5) -> c1 (discrete, 15)
6: top (discrete, 7) -> c1 (discrete, 15)
7: b (discrete, 5) -> c1 (discrete, 15)
8: os (discrete, 4) -> c1 (discrete, 15)

initializing the distributions...
creating interference Engine
begin learning cases
Traceback (most recent call last):
File "bayesian_network_test.py", line 46, in ?
ie.LearnMLParams(cases)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/site-packages/OpenBayes/inference.py", line 63, in
LearnMLParams
v.distribution.incrCounts(case)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/site-packages/OpenBayes/distributions.py", line 227, in
incrCounts
self.counts[index] += 1
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/site-packages/OpenBayes/table.py", line 150, in
__getitem__
return self.cpt[numIndex]
IndexError: Index out of range

Any ideas what is going wrong? Right now I am just trying to learn
from a dummy test cases with only 2 samples.

You can see above what my Network looks like, the distributions
initialize properly, the IE used is MCMC, and here is the content of
my 2 samples cases:

cases = [ {'dow': 1, 'hod':13, 'r':3, 'cr':4, 'dr':3, 'ur':2, 'top':
2, 'b':1, 'os':1, 'c1':2},
{'dow': 5, 'hod':5, 'r':2, 'cr':1, 'dr':5, 'ur':2, 'top':1, 'b':4,
'os':2, 'c1':5} ]

Thank you in advance for your guidance.

Cheers!

Sébastien Arnaud
Posted by obadmin at November 04. 2006
i have run into errors in that line of code before. I might have some ideas about where it is going wrong. However, my computer died on me a week ago, and i am just starting to get it back (lets hope), but i definitely don't have any kind of environment up yet. As soon as i get everything setup i will look at it and let you know.

-Elliot
Posted by obadmin at November 07. 2006
I'm trying to localize your problem. Could you please send me a python script file that reproduces the error?

Please try to isolate the problem. By this I understand that the BN you will sent me must be the simplest possible that still reproduces the error.

Kosta
Posted by obadmin at November 20. 2006
This bug has now been fixed!

Actually there were 2 distinct bugs: 1 in the JoinTree and the other one in the MCMCEngine.

Small description of the bugs :
JoinTree: After Learning the parameters of the network the clusters where not reinitialized to take into account the changes made by the learning engine. EasyFix

MCMCEngine: In order to perform forward sampling to acquire the samples of a BN we first need to make a topological sort of the network (starting from the nodes without parents and ending to the nodes without children). There was a small bug in the topological sort that lead to errors in certain configurations. Succesfully fixed by first finding a node without parents and then perform a classical topological starting from that node instead of starting at a random node (as was done before)

Thank you sebastien for helping us tracking down these.

Kosta
Posted by obadmin at November 22. 2006
Thank you Kosta for getting those corrected. It is working great now!

Sorry if I haven't been posting on the forums my messages back to you. Email is just too easy sometimes ;)

Sébastien
Powered by Ploneboard

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: