Personal tools
You are here: Home Discussion

Discussion

Up to the Feature Requests 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.

A way to save a Bnet?

Posted by arnaudsj at November 09. 2006
Hi,

Maybe I missed something in the tutorials, but what I did is build a very simple BNet, and used empirical data and used MCMC to obtain the various probability coefficients for each node. It works great, btw ;)

Now, I want to reuse this "trained" BNet and present it some new data so that it can do it's job and guess the outcome. My question though is: what is the easiest way for me to save my "trained" BNet so that I can invoke it in another scripts. My wish would be that it could be saved on disk as a file. Or even if the whole BNet structure is not saved, at least having the ability to save the probability distribution for all the nodes, since the Bnet structure won't change, and I can easy build a python module to hold my Bnet structure.

Thanks!

Sébastien
Posted by arnaudsj at November 10. 2006
Thanks,

There is a module under development that allows you to save/read any BN into a file using the XBN file format.
The responsible for this project is Ronald Moncarey (in case you have any questions)

This module is not yet included in the package that you can download from this site. However you can get it from the SVN repository in BerliOS. It will soon be included in the main package.

To get the file from the svn server do the following :
1) go to the address : http://svn.berlios.de/wsvn/pybayes/branches/OpenBayesGUI/?rev=0&sc=0
2) download the file OpenBayesXBN.py into your openbayes directory

and you're ready to read and write files. There is no tutorial yet but it shouldn't be hard to make it work.

Btw, Ronald has also developped a GUI that allows you to visualize your BN after it has been saved in a file. Beta version also but could be helpful.

Don't hesitate if you have any questions

Kosta
Posted by obadmin at November 10. 2006
Flavio suggested that you pickle your graph using the python built-in function pickle.

This could work, I suggest you however to first try the XBN module as XBN is a standard Bayesian Network file format that can be read by other software.

Kosta

PS: I'm sorry for retracting your message Flavio... I did a wrong manipulation
Posted by fccoelho at November 10. 2006
Hi Sebastien,

For now You could just Pickle your network.

If you are not familiar with this concept check Python Built-in docs for how to pickle and unpickle Python objects.

Flávio
Powered by Ploneboard

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: