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.

Bug report

Posted by fabriziorig at February 22. 2007
Hi,
I have ecountered the following bug:
I load a network from an XBN file, the loading goes well but when I do inference I got the error reported below.

You can find the XBN file alarmc.xbn at
http://www.ing.unife.it/docenti/FabrizioRiguzzi/alarmc.xbn

Any idea what happened?

Thanks,
Fabrizio

Error:
-------------
Traceback (most recent call last):
File "./testalarmc.py", line 9, in
ie=JoinTree(G)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 426, in __in
it__
self.GlobalPropagation()
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 514, in Glob
alPropagation
start.CollectEvidence()
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 187, in Coll
ectEvidence
if not v.marked: v.CollectEvidence(self)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 187, in Coll
ectEvidence
if not v.marked: v.CollectEvidence(self)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 187, in Coll
ectEvidence
if not v.marked: v.CollectEvidence(self)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 187, in Coll
ectEvidence
if not v.marked: v.CollectEvidence(self)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 187, in Coll
ectEvidence
if not v.marked: v.CollectEvidence(self)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 189, in Coll
ectEvidence
if not X == None: self.MessagePass(X)
File "C:\Python25\Lib\site-packages\OpenBayes\inference.py", line 168, in Mess
agePass
newphiR = self.potential + e.potential # phiR = sum(X/R)phiX
File "C:\Python25\Lib\site-packages\OpenBayes\potentials.py", line 154, in __a
dd__
return self.Marginalise(var)
File "C:\Python25\Lib\site-packages\OpenBayes\potentials.py", line 117, in Mar
ginalise
return DiscretePotential(newnames, temp.shape, temp)
AttributeError: 'float' object has no attribute 'shape'
-------------
File testalarmc.py:
------------
#! /usr/bin/env python
from OpenBayes import LoadXBN,JoinTree,MCMCEngine
from time import clock

l=LoadXBN("alarmvar.xbn")
G=l.Load()

t=clock()
ie=JoinTree(G)
print ie.Marginalise('alarm_t_')
t=clock()
print t
Posted by arnaudsj at February 23. 2007
Hi Fabrizio,

I don't think OpenBayes has been tested extensively under Python2.5 yet.

I ran your test script against your XBN file and I got the successful output:

INFO:root:Creating JunctionTree engine for bndefault
INFO:root:Constructing Optimal Tree
INFO:root:Moralising Tree
INFO:root:Triangulating Tree and extracting Clusters
INFO:root:Connecting Clusters Optimally
INFO:root:Initialising Potentials for clusters and SepSets
INFO:root:Global Propagation, starting at :earthq_f_c_5_
INFO:root: Collect Evidence
INFO:root: Distribute Evidence
Multinomial Distribution for node : alarm_t_
Conditional Probability Table (CPT) :
array([ 0.86200321, 0.13799682], type=Float32)
0.49

Hope this helps!

Sébastien
Posted by fabriziorig at February 23. 2007
Hi,
thanks for you quick reply.
I tried the same script with python 2.4 on a windows machine and on a linux machine and I get the same error.
Are you using a development version of OpenBayes?
I downloaded my version from the dist direcotory.

Thanks,
Fabrizio
Posted by arnaudsj at February 25. 2007
Hi,

I am not sure which version I am running :) I downloaded whichever one was last released in December.

You might want to try an older revision:
http://svn.berlios.de/wsvn/pybayes/branches/Public/dist/OpenBayes-0.1.0.tar.gz?op=log&rev=0&sc=0&isdir=0

I hope that Kosta is considering using a python-egg to distribute OpenBayes at some point, so that it becomes much easier to upgrade the package and manage different releases.

Thanks,

Sébastien
Posted by fabriziorig at February 25. 2007
Hi,
sorry I made a mistake, the file that gives me the error is not alarmc.xbn but alarmvar.xbn,
here it is
http://www.ing.unife.it/docenti/FabrizioRiguzzi/alarmvar.xbn
Here is the python script that gives me the error
http://www.ing.unife.it/docenti/FabrizioRiguzzi/alarmvar.py

alarmc.xbn works also for me

Thanks,
Fabrizio
Powered by Ploneboard

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: