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 running SEMLearning.py example
The error also happens using the EMlearning.py example:
Traceback (most recent call last):
File "EMlearning.py", line 33, in ?
engine.EMLearning(cases, 10)
File "/usr/lib/python2.4/site-packages/OpenBayes/learning.py", line 58, in EMLearning
while self.hasntConverged(old, new, precision) and iter < max_iter:
File "/usr/lib/python2.4/site-packages/OpenBayes/learning.py", line 182, in hasntConverged
return not na.alltrue([na.allclose(v.distribution, new.v[v.name].distribution, atol=precision) for v in old.v.values()])
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 1519, in allclose
x, y = asarray(array1), asarray(array2)
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 434, in asarray
return array(seq, type=type, typecode=typecode, copy=0, dtype=dtype)
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 425, in array
return fromlist(sequence,type,shape)
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 248, in fromlist
if not len(seq) and type is None:
TypeError: len() of unsized object
Traceback (most recent call last):
File "EMlearning.py", line 33, in ?
engine.EMLearning(cases, 10)
File "/usr/lib/python2.4/site-packages/OpenBayes/learning.py", line 58, in EMLearning
while self.hasntConverged(old, new, precision) and iter < max_iter:
File "/usr/lib/python2.4/site-packages/OpenBayes/learning.py", line 182, in hasntConverged
return not na.alltrue([na.allclose(v.distribution, new.v[v.name].distribution, atol=precision) for v in old.v.values()])
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 1519, in allclose
x, y = asarray(array1), asarray(array2)
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 434, in asarray
return array(seq, type=type, typecode=typecode, copy=0, dtype=dtype)
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 425, in array
return fromlist(sequence,type,shape)
File "/usr/lib/python2.4/site-packages/numarray/numarraycore.py", line 248, in fromlist
if not len(seq) and type is None:
TypeError: len() of unsized object
Using the branches version of the svn repository with learningwanna.py I still get this error...
Yep
you're right, there are some bugs left over in the SEM algorithm. This part of the code was broken when we tried to change some stuff in the distributions.
We are correcting this in the new version of OpenBayes that will be available during April. For the moment, we have stopped correcting bugs for the current version.
Sorry for the inconvenience, but you'll have to wait a little bit...
kosta
you're right, there are some bugs left over in the SEM algorithm. This part of the code was broken when we tried to change some stuff in the distributions.
We are correcting this in the new version of OpenBayes that will be available during April. For the moment, we have stopped correcting bugs for the current version.
Sorry for the inconvenience, but you'll have to wait a little bit...
kosta
Powered by Ploneboard
I am trying to run the examples in the OpenBayes 0.1.0 package. I am
using Python 2.4.4 and Numarray 1.5.2. When I run SEMLearning.py using
the following code in WaterSprinkler.py:
from OpenBayes import BNet, BVertex, DirEdge, Graph
from traceit import *
import sys
# create the network
G = BNet( 'Water Sprinkler Bayesian Network' )
c, s, r, w = [G.add_v( BVertex( nm, True, 2 ) ) for nm in 'c s r w'.split()]
for ep in [(c,r), (c,s), ( r, w ), ( s, w )]:
G.add_e( DirEdge( len( G.e ), *ep ) )
print G
# finalize the bayesian network once all edges have been added
G.InitDistributions()
i am getting the following error trace:
[sergior@elf Examples]$ python2.4 SEMLearning.py
BNet Water Sprinkler Bayesian Network
Vertices:
c (discrete, 2)
r (discrete, 2)
s (discrete, 2)
w (discrete, 2)
Edges:
0: c (discrete, 2) -> r (discrete, 2)
1: c (discrete, 2) -> s (discrete, 2)
2: r (discrete, 2) -> w (discrete, 2)
3: s (discrete, 2) -> w (discrete, 2)
EM iteration: 1
Traceback (most recent call last):
File "SEMLearning.py", line 32, in ?
struct_engine.SEMLearning(cases)
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/OpenBayes/learning.py",
line 410, in SEMLearning
self.EMLearning(cases, 10)
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/OpenBayes/learning.py",
line 58, in EMLearning
while self.hasntConverged(old, new, precision) and iter < max_iter:
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/OpenBayes/learning.py",
line 182, in hasntConverged
return not na.alltrue([na.allclose(v.distribution,
new.v[v.name].distribution, atol=precision) for v in old.v.values()])
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/numarray/numarraycore.py",
line 1518, in allclose
x, y = asarray(array1), asarray(array2)
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/numarray/numarraycore.py",
line 434, in asarray
return array(seq, type=type, typecode=typecode, copy=0, dtype=dtype)
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/numarray/numarraycore.py",
line 425, in array
return fromlist(sequence,type,shape)
File
"/home/HU.shadow/sergior/python/lib/python2.4/site-packages/numarray/numarraycore.py",
line 248, in fromlist
if not len(seq) and type is None:
TypeError: len() of unsized object
I have reproduced this error using numarray 1.3.3. Using python 2.5 i only get floating point exceptions...