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.

Learning Structure: 'BNet' object has no attribute 'copy'

Posted by ChrisB at March 13. 2007
Hi,
I've been following your tutorial to learn structure from sample data.
http://www.openbayes.org/tutorials/learning-the-structure-of-a-bn-from-sample-data
The file StructLearning.py doesn't exist in the Examples directory, and creating the file by hand results in the following error:


File "C:\Python25\Lib\site-packages\OpenBayes\learning.py", line 194, in __init__
self.BNet = BNet.copy()
AttributeError: 'BNet' object has no attribute 'copy'

This occurs at the following point:
# Learn the structure
struct_engine = learning.GreedyStructLearningEngine(G2)

I came back to the example as I was using my own test data set and thought it might have been that which was causing the error.

As you can see i'm doing this on a windows box ;)

I'd appreciate any help with this, I'm not really a python person :(
I've looked into learning.py and copy is defined so I'm at a loss...
Thanks,

Chris
Posted by ChrisB at March 13. 2007
Bugger this was meant to go into the bugs section, sorry.
Posted by ChrisB at March 14. 2007
Never mind I've made some changes to learning.py altering BNet.copy() to copy.copy(BNet) and its associates, which appears to have solved the problem.

WaterSprinkler now works although is a bit messed up, giving me a fully connected tree, which six edges :|
Powered by Ploneboard

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: