How to save an unrolled network in pySmile?
-
- Posts: 3
- Joined: Wed Jan 27, 2021 2:36 pm
How to save an unrolled network in pySmile?
I want to unroll a dynamic Bayesian network model and write the unrolled network using the write_file() command. However, the original rolled network can only be saved into a .xdsl file. I understand that the unrolled network is an independent model but I haven't been able to figure out the correct way to call the unrolled network and save it into a .xdsl file. Seems like I am missing something here. Thank you
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to save an unrolled network in pySmile?
You need to call Network.unroll first to obtain an UnrollResults object. One of its members contains a reference to the unrolled network. Use Network.write_file to save this network.
(I assume you're using PySMILE based on the write_file comment in your message).
(I assume you're using PySMILE based on the write_file comment in your message).
-
- Posts: 3
- Joined: Wed Jan 27, 2021 2:36 pm
Re: How to save an unrolled network in pySmile?
That works! Thanks a lot
-
- Posts: 34
- Joined: Thu Mar 19, 2020 11:49 am
Re: How to save an unrolled network in pySmile?
may i ask how you store the unrolled DBN succesfully? i use below two row codes, but the results shown that i only save original dbn again. could you please tell me how you did that part?
pysmile.UnrollResults = net.unroll()
net.write_file('unrolledDBN.xdsl')
pysmile.UnrollResults = net.unroll()
net.write_file('unrolledDBN.xdsl')
-
- Site Admin
- Posts: 61
- Joined: Mon Nov 06, 2017 6:41 pm
Re: How to save an unrolled network in pySmile?
UnrollResults contains unrolled PyNetwork and mapping (an array). You can simply save unrolled network by write_file method call e.g.
Code: Select all
unroll_results = net.unroll()
unroll_results.write_file("filename.xdsl")
-
- Posts: 34
- Joined: Thu Mar 19, 2020 11:49 am
Re: How to save an unrolled network in pySmile?
thank you very much! But when I use these two rows to save the unrolled network, it tells me " AttributeError": 'pysmile.UnrollResults' object has no attribute ' write_file'.
I use dir(pysmile.UnrollResults),write_file is not the attribute of pysmile.UnrollResults, as shown in attached picture.
could you please tell me how to store it then? thank you very much!
I use dir(pysmile.UnrollResults),write_file is not the attribute of pysmile.UnrollResults, as shown in attached picture.
could you please tell me how to store it then? thank you very much!
- Attachments
-
- WechatIMG4.jpeg (254.71 KiB) Viewed 10689 times
-
- Site Admin
- Posts: 61
- Joined: Mon Nov 06, 2017 6:41 pm
Re: How to save an unrolled network in pySmile?
This is my mistake in the previous post - use write_file method on unrolled property.
Code: Select all
unroll_results.unrolled.write_file("filename.xdsl")