Creation of Equation Nodes via jSmile API

The engine.
Post Reply
Markus B
Posts: 3
Joined: Tue Aug 25, 2009 2:01 pm

Creation of Equation Nodes via jSmile API

Post by Markus B »

Hello everybody,

I want to create an network, which contains equation nodes. My program is written in Java, so I use the latest jsmile library (the July 28, 2009 release).

But I am having problems to set the definition of a equation node.

My program looks like this:
public static void main(String[] args){
Network net = new Network();
net.addNode(4, "equationNode"); // 4 as there exists no stereotype for equation nodes

net.setNodeDefinition("equationNode", "equationNode = 1");
}

This fails, as the second argument of net.setNodeDefinition is required to be a double array. For other nodes, this requirement is understandable, but for equation nodes, this limitation is not helpful.

So my question is, how can I set the definition of an equation node?
How is this realized in GeNIe and in what way are equation nodes supported in general?

Thanks for your help,
Markus
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Creation of Equation Nodes via jSmile API

Post by shooltz[BayesFusion] »

Markus B wrote:So my question is, how can I set the definition of an equation node?
How is this realized in GeNIe and in what way are equation nodes supported in general?
The C++ SMILE APIs for equation nodes are not exposed in jSMILE at the moment (in fact, we don't even distribute the relevant headers with C++ library). We'll release the updated jSMILE later this week; this build will contain basic functionality related to equation nodes.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Creation of Equation Nodes via jSmile API

Post by shooltz[BayesFusion] »

jSMILE binaries for Win32 have been updated. This release contains the support for equation nodes. Update jSMILE sources and Linux binaries are not posted yet - let me know if you're using Linux.

The following new jSMILE APIs can be used with equation nodes:

Network.NodeType.Equation
Network.setNodeEquation
Network.getNodeEquation
Network.setNodeEquationBounds
Network.getNodeEquationBounds
Network.setContEvidence
Network.getContEvidence

The implementation of Network.getNodeValue has been updated. For equation nodes Network.getNodeValue will return an array containing two or more elements. nodeValue[0] is the mean of the samples generated for node. nodeValue[1] is the standard deviation or zero if inference algorithm was able to determine the value of node exactly. If stddev is nonzero, the remaining elements of the array are weighted samples generated by the algorithm.

Final note: the equation support in SMILE is not as mature and tested as other parts of the library. If you encounter any issues, please let us know.
Markus B
Posts: 3
Joined: Tue Aug 25, 2009 2:01 pm

Post by Markus B »

Thank you for the update. I just tried a test-case and so far it seems to work fine. I'll let you know if I encounter problems.


Markus
Post Reply