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

Rewriting Onyx Script Export to be more readable #10

Open
timovonoertzen opened this issue Dec 21, 2023 · 0 comments
Open

Rewriting Onyx Script Export to be more readable #10

timovonoertzen opened this issue Dec 21, 2023 · 0 comments

Comments

@timovonoertzen
Copy link
Collaborator

timovonoertzen commented Dec 21, 2023

The Onyx Script Export in importexport.OnyxJavaExport should be more readable. Timo added some methods to OnyxModel that generate nodes/edges and request their addition. Code like this works and looks fairly good, plus should be easy to put in loops for extending in some design:

public static void tryingReadableBuild()  {
    OnyxModel model = new OnyxModel();
    model.setMeanTreatment(MeanTreatment.implicit);

    Node n1 = model.newNode("M1", false); 
    Node n2 = model.newNode("M2", false); 
    Node n3 = model.newNode("factor",true); 
    Edge e1 = model.newEdge(n3,n1,false,1.0); 
    Edge e2 = model.newEdge(n3,n2,false,1.0); 
    Edge v1 = model.newEdge(n1,n1,true,"var1",1.0); 
    Edge v2 = model.newEdge(n2,n2,true,"var2",1.0); 
    Edge v3 = model.newEdge(n3,n3,true,"factor Variance",1.0);

    RawDataset data = RawDataset.loadRawDataset("exampleData.txt");
    
    boolean allok = model.runUntil(data, Until.CONVERGED, 60000);
    if (!allok) System.err.println("Model "+model.name+" did not converge reliably.");
    ModelRunUnit est = model.modelRun.getBestUnit();
    System.out.println(est.getParameterDescription());

}

Torben is assigned to create the new export function in a fork, to be remerged after control by Andy.

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

No branches or pull requests

1 participant