Can SMILE process a .DSL file generated by GeNIe?

The engine.
Post Reply
djinn
Posts: 6
Joined: Tue Dec 04, 2007 8:56 am

Can SMILE process a .DSL file generated by GeNIe?

Post by djinn »

I used GeNIe to design a simple Bayesian network similar to the tutorial version. After which, I saved the network in .DSL and .XDSL formats.

After which, I tried to read in and work with the network (both .DSL and .XDSL files) in a .CPP file using SMILE libraries (for 64 bit) but I got "Segmentation fault" error when executing the code.

On the other hand, when I crafted the exact same network in SMILE directly (using functions like GetNode, AddArc, and classes like DSL_sysCoordinates, DSL_network, etc.), write to file the SMILE-crafted network, read in the same file, and run inference on it, everything works.

The question here is, what is the difference between the network file generated using SMILE, compared to the one generated using GeNIe? Why is it that SMILE cannot handle GeNIe's .DSL file while it can handle the .DSL file which it generates itself? Did I miss anything when designing the network in GeNIe?

This is a rather important issue I feel since it is more practical and faster to design Bayesian networks in a nice environment with GUI, rather than having to write everything in the source codes.

Any help on this is highly appreciated!!
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Can SMILE process a .DSL file generated by GeNIe?

Post by shooltz[BayesFusion] »

XDSL files created by GeNIe: you should be able to load them without any issues on any platform - as long as you call global function EnableXdslFormat before DSL_network::ReadFile. If EnableXdslFormat is not called, you'll get DSL_FILE_FORMAT_ERROR (-46) from ReadFile.

DSL files created by GeNIe: they contain MS-DOS style (\n\r) line endings, and if you don't convert them to Unix-style \n, you'll get DSL_SYNTAX_ERROR (-127). They should load fine once the line endings are converted. DSL is the old format, which is no longer maintaned - we strongly suggest using XDSL.

Can you verify if you're actually getting segmentation faults with both file formats before ReadFile returns?
djinn
Posts: 6
Joined: Tue Dec 04, 2007 8:56 am

Post by djinn »

Hi again shooltz,

Sorry for not being that clear in my earlier post. There is no problem reading in a .DSL file. The problem arose when I tried using DSL_sysCoordinates.

A segment of the code is as followed:

DSL_network theNet;
theNet.ReadFile("testNet.dsl");
theNet.UpdateBeliefs();
int behavior = theNet.FindNode("behavior");
//no problem until here

DSL_sysCoordinates theCoordinates(*theNet.GetNode(behavior)->Value());
//the above line did not go through and segmentation fault occured.
djinn
Posts: 6
Joined: Tue Dec 04, 2007 8:56 am

Post by djinn »

Managed to get it working by adding "EnableXdslFormat()" and reading in .XDSL file. Couldn't get .DSL to work but it doesn't matter anymore to me.

Thanks again shooltz!
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

My best guess is that your program tried to continue after ReadFile returned the error code. The call to FindNode returned NULL (network was empty) and later you invoked DSL_node::Value method on NULL pointer, which gave you the segfault.

I suggest checking the return values - you may hit similiar problems in the future :)
Post Reply