different results for Genie and Smile

The engine.
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

let's see.

overall:
Load the net (all states of all nodes are uniform distributed).
Set the algorithm for the inference
set priors
set evidences
call UpdateBeliefs()
Collect the meaningful targets and find the max posterior


1. Set evidence for a number of nodes (for how many nodes, do you set soft evidence?, how many nodes do not receive any evidence?)
I have a net with 66 nodes. priors are set for four of them. Evidence is coming for 8 of them. all the rest are inference nodes. Real targets are 21. That means I have 21 classes where I compare the outcomes to find the max.

3. Check probabilities (how do you check them in the code? how in Genie?)
the targets only have "true"/"false" states, I search the maximuum of the "true" states.
node->Value()->GetMatrix()->Subscript(0);
In genie, I just look at the bar charts. Evidence are set by context menue for the same nodes. and the priors in the definitions.
I did not understood the diagnostic and case manager stuff... so I do not use until now.
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

Why are all the states of the nodes uniformly distributed? That surprises me a bit.
You mention setting priors later for some node, why not just set these prior distributions in the nodes the network itself (as in setting the values in genie and saving the network)?

So, you have 21 class nodes, which are initialized uniformly. How do you search the maximum of the true states? You look at P(true) for all the nodes and then find the maximum?

Can you send me this network so I can have a look at it?
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

I use GENIE just to build the structure of the net.
The parameter are set in the app.
The priors are calculated in real-time by in the starting time of the app. The evidence is then computed step by step and thereby set.

I can send it as private, not for the public.
You get a PN.
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

Re: different results for Genie and Smile

Post by orzech »

Actually I've spent a lot of time trying to figure out how to set up Smile to produce the same results as Genie. AFAIR, Genie uses d-separation by default. You can look through this topic: http://genie.sis.pitt.edu/forum/viewtop ... +relevance
alpineda
Posts: 3
Joined: Sun Apr 14, 2013 7:34 pm
Contact:

Re: different results for Genie and Smile

Post by alpineda »

Hi!

I have a naïve structure, then I set some evidence and when I update the beliefs I get different results for the target in Genie and Smile.
I am using jSMILE on Mac OSX. All my nodes are binary (T,F). Here is the code I am using:

Code: Select all

import smile.Network;

public void runner() {
// [1] Read Bayes Model
Network net = new Network();
net.readFile(data/model.xdsl);

// [2] Assign evidence
net.setEvidence("Fever", "T");
net.setEvidence("Coughing", "F");
...
net.setEvidence("Headache", "F");

// [3] Update beliefs
net.updateBeliefs();

// [4] Print results
double[] aValues = net.getNodeValue("Influenza");
System.out.println("P(Influenza=T|evidence)= " + aValues[0]);
System.out.println("P(Influenza=F|evidence)= " + aValues[1]);
}

I would greatly appreciate any help,

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

Re: different results for Genie and Smile

Post by shooltz[BayesFusion] »

We won't be able to help if you don't post your network here.
alpineda
Posts: 3
Joined: Sun Apr 14, 2013 7:34 pm
Contact:

Re: different results for Genie and Smile

Post by alpineda »

Hi,

With the attached model, I tried the case described below and GeNIe outputs a slightly different result than SMILE:

Code: Select all

//Evidence being set for Case 1
net.setEvidence("C0013404", "F");
net.setEvidence("C0015967", "F");
net.setEvidence("C0085593", "F");
net.setEvidence("C0235592", "F");
net.setEvidence("C0242429", "F");
net.setEvidence("C0008031", "F");
net.setEvidence("C0043144", "F");
net.setEvidence("C0009763", "F");
Then my target node after updating beliefs gets these values in SMILE:
P(BC0021400=T|Evidence) = 0.0010307042208261006
P(BC0021400=F|Evidence) = 0.9989692957791738

If I repeat the same process in GeNIe, the values I get are:
P(BC0021400=T|Evidence) = 0.015945176
P(BC0021400=F|Evidence) = 0.98405482
Attachments
naiveB-influenza.xdsl
(14.13 KiB) Downloaded 435 times
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: different results for Genie and Smile

Post by shooltz[BayesFusion] »

GeNIe calculates the beliefs for BC0021400 as {0.0010307042, 0.9989693} with the evidence applied. Without the evidence the beliefs are {0.015945176, 0.98405482}, which leads me to believe that you didn't actually enter the evidence in GeNIe.
alpineda
Posts: 3
Joined: Sun Apr 14, 2013 7:34 pm
Contact:

Re: different results for Genie and Smile

Post by alpineda »

Oh! you're right! Actually I had to re-update the beliefs in my network to get the right values!
Thank you so much! :P
Post Reply