instantiate new objects

Felix Steffenhagen felix.steffenhagen at
Thu Mar 10 21:47:10 CET 2005

Hello @ all,

i'm a newbie in python and have written a module for computations in a 
bayesian network.

The module can be found at:

In this module i define four classes.
- cdp (conditional probability [distribution]) consisting of cdp_entry 
- graph ( a graph class )
- bayesNet ( the bayesian network, a subclass of graph )

My problem is the following:
I have a global method test() in the module, where i want to test my 
implementation of the em-learning algorithm, for learning parameters in 
a bayesian network.
When I import this module in the python environment and then run the 
test method, everything seems to be ok, and the calculations that are 
hardcoded in this method seems to be correct.
In the test method i instantiate a bayesNet object for the further 
The results that are computed and printed are probability distributions 
in the bayesian network, but this is not important for the problem.
The problem comes when i want to run the test method again for a second 
time. What happens is that the "same" expressions/computations listed
in the test method leads to another results, even if the commands are 
the same.
I can only imagine that this comes out of some objects that are not
destroyed and influence the new bayesNet object that is created there.

If there is a problem with the instantiations, it is in the test method 
which is at the end of the file (see above)
Does someone see the problem there???

If you need some more information about what happens in the module 
please write me a mail, but i hope the comments are enough to understand 
the problem.

If you think this is too much off-topic we can discuss the problem out 
of the newsgroup.

thanks in advance,
Felix Steffenhagen

More information about the Python-list mailing list