Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save an load a DBN in hugin format #54

Open
rcabanasdepaz opened this issue Oct 17, 2016 · 0 comments
Open

Save an load a DBN in hugin format #54

rcabanasdepaz opened this issue Oct 17, 2016 · 0 comments
Assignees
Labels

Comments

@rcabanasdepaz
Copy link
Contributor

It seems that the code for saving a DBN in hugin format is not correct. In the following code,
I save a DBN and then I try to load it.

    //Load the data stream
    String path = "datasets/simulated/";
    String filename = path+"BCC_month0.arff";
    DataStream<DynamicDataInstance> data =
            DynamicDataStreamLoader.loadFromFile(filename);

    //Learn the dynamic model
    DynamicModel model =
            new HiddenMarkovModel(data.getAttributes());
    model.updateModel(data);

    // Print the BN and save it
    DynamicBayesianNetwork dbn = model.getModel();
    System.out.println(dbn);
    DynamicBayesianNetworkWriter
            .save(dbn, "networks/simulated/BCCDBN.dbn");

    DynamicBayesianNetworkWriterToHugin
            .save(dbn, "networks/simulated/BCCDBN.oobn");

    //Load the DBN
    DBNLoaderFromHugin.loadFromFile("networks/simulated/BCCDBN.oobn");

I get the following exception:

Parse error in line 1: expected `class' keyword
Exception in thread "main" COM.hugin.HAPI.ExceptionParse: An error occurred during parsing. If a parse error handling function was specified, it will have been called with a description of the error and its location in the source.
at COM.hugin.HAPI.ExceptionHugin.throwException(ExceptionHugin.java:107)
at COM.hugin.HAPI.ClassCollection.parseClasses(ClassCollection.java:107)
at eu.amidst.huginlink.io.DBNLoaderFromHugin.loadFromFile(DBNLoaderFromHugin.java:39)
at eu.amidst.tutorial.usingAmidst.more_examples.DynamicModelLearning.main(DynamicModelLearning.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants