YANC, Yet another newbie question
I have made a simple network of four nodes.
Used GENIE to set it up.
I set no evidence, just update the network using the cluster setting in GENIE.
And then I manually read the the posterior from the nodes.
I save the network to a xdsl file. The read it into C++, update beliefs and try to read out the same results, from the same node.
Then I get only 1.0 in the first state, and nothing more.
The C++ program and the xdsl file is provided below.
Any help is appreciated....
Thanx
./Bernt
----------------
Code: Select all
/* Test of GENIE and SMILE */
#include "sdbn.h"
void myDummy(void) {
DSL_network theNet;
printf("Reading network\n");
theNet.ReadFile("dum.xdsl");
// update the network with inital definitions only.
theNet.UpdateBeliefs();
int mL = theNet.FindNode("mL");
printf("Handle of node mL = %d\n", mL);
DSL_sysCoordinates theCoordinates (*theNet.GetNode(mL)->Definition());
for(int n = 0; n<3; n++) {
printf("n=%d %.3f \n", n, theCoordinates.UncheckedValue() );
theCoordinates.Next();
}
};
/////////////////////////////////////////////////////////
int main(int argc, char *argv[]) {
myDummy();
return 0;
} // End main
/////////////////////////////////////////////////////////
The network: saved in file dum.xdsl
-------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<smile version="1.0" id="Network2" numsamples="1000" discsamples="10000">
<nodes>
<cpt id="Acc">
<state id="Acc0mm" />
<state id="Acc1mm" />
<state id="Acc2mm" />
<probabilities>0 0.3 0.7</probabilities>
</cpt>
<cpt id="Mlt">
<state id="State0" />
<state id="State1" />
<state id="State2" />
<probabilities>0.3 0.3 0.4</probabilities>
</cpt>
<deterministic id="aL">
<state id="State0" />
<state id="State1" />
<state id="State2" />
<state id="State3" />
<state id="State4" />
<state id="State5" />
<state id="State6" />
<parents>Acc</parents>
<resultingstates>State0 State1 State2</resultingstates>
</deterministic>
<deterministic id="mL">
<state id="State0" />
<state id="State1" />
<state id="State2" />
<state id="State3" />
<state id="State4" />
<state id="State5" />
<state id="State6" />
<parents>aL Mlt</parents>
<resultingstates>State0 State0 State0 State1 State0 State0 State2 State1 State0 State3 State2 State1 State4 State3 State2 State5 State4 State3 State6 State5 State4</resultingstates>
</deterministic>
</nodes>
<extensions>
<genie version="1.0" app="GeNIe 2.0.4843.0" name="Network2" faultnameformat="nodestate">
<node id="Acc">
<name>Acc</name>
<interior color="e5f6f7" />
<outline color="000080" />
<font color="000000" name="Arial" size="8" />
<position>304 130 345 155</position>
</node>
<node id="Mlt">
<name>Mlt</name>
<interior color="e5f6f7" />
<outline color="000080" />
<font color="000000" name="Arial" size="8" />
<position>410 133 450 158</position>
</node>
<node id="aL">
<name>aL</name>
<interior color="e5f6f7" />
<outline color="000080" />
<font color="000000" name="Arial" size="8" />
<position>300 221 355 258</position>
</node>
<node id="mL">
<name>mL</name>
<interior color="e5f6f7" />
<outline color="000080" />
<font color="000000" name="Arial" size="8" />
<position>407 224 462 261</position>
</node>
</genie>
</extensions>
</smile>
-------