different results for Genie and Smile

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

different results for Genie and Smile

Post by techmec »

Hi,

I'm playing with Genie and Smile to understand that stuff.
I modelled a BN in Genie und load it into SMILE by .dsl format.
I set the identical evidence (soft).

In Genie it's the clustering I use and in Smile the first algorithmn should be the adequate (index 0, lauritzen), right?

The values in my targets are different.

Thanks
techmec
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

Hi Techmec,

How and where did you set the evidence?

btw. are you using the .xdsl format? the .dsl format is actually older and not really used anymore.

Best,

Martijn
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

Hi Martijn,

I'm using dsl only because I got an error when I initially tried xdsl. I thought it doesn't matter. I think I retry that.

The evidence is set as soft evidence.
Setting the evidence is done by node->value->setsoftevidence, with the double std::vector.
And the a-priori by using setDefinition(), with a DSL_doublearray.
I proofed that, the values have been set.


I just set the Algorithmtype, set the evidence and then call UpdateBeliefs();

Greetz,
techmec
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

How do the results differ?
Are they big, or small, could they be rounding errors?
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

Hi,

when I use the SMILE lib the outcomes of the targets vary just between 0.25 and 0.28. The most are very very close together.
In the GENIE application the values vary (with same evidence set) between 0.20 and 0.70.
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

What does the code look like exactly?
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

Okay, well.
I now saved the net as xdsl.

If I save the net which I use in SMILE after setting the a-priori informations (setDefinition), and then load the net into Genie, both nets work identically.
So what is left... the setting of the evidence. As I cannot save it, I can't proof it in GENIE.

Code?

Code: Select all

int index= BNStorage[which]->net.FindNode("my_Color");
if (index>=0){ 
DSL_node* node=BNStorage[which]->net.GetNode(index);
std::vector<double > f;
for (int i=0;i<possibleColors;i++) f.push_back((1.0-cutoffvalue)/possibleColors-1);
f[statenumber]=cutoffvalue;
node->Value()->SetSoftEvidence(f);
}

The cutoffvalue is the evidence, scaled (If I'm sure it's 1.0, if not so much 0.8 and so on)

Seems to be a self-made problem, or?
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

Are you sure about what you put in f?

(1.0-cutoffvalue)/possibleColors-1

is the 1.0-cutoffvalue supposed to be divided by possibleColors or possibleColors-1?
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

Should be ok.

I want to set the value for experimental usage as 1.0, 0.8, 0.6 and so on to look how "sure" I have to be to get the right target in the end.
The rest of the values should be uniform, but of course they have to sum up to 1.
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

I'm very glad that you try to help me thanks for that
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

Ok, but this -1 at the end could be an issue

If your cutoff is say 1.0 then the other should be 0

(1-1)/3 -1 = -1
or
0/(3-1) = 0/2 = 0

Same for 0.6

(1-0.6)/3 -1 = (0.4)/3 -1 = -0.87
or
(1-0.6)/(3-1) = 0.4/2 = 0.2

It does make a difference

So are you sure about this?
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

OH, I'm sorry.
In my code its a real number not a variable.

I only posted it as variable, because I thought it explains itself better.

My fault.

Otherwise you are clearly right.
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

Ok, I see.

So, just to make sure everything is completely clear, could you post the code segment as it is exactly?
techmec
Posts: 21
Joined: Sun Feb 05, 2012 2:53 pm

Re: different results for Genie and Smile

Post by techmec »

OK

Code: Select all

case 1:{
int index=BNStorage[which]->theNet.FindNode("pxisColor");
if (index>=0){
DSL_node* node=BNStorage[which]->theNet.GetNode(index);
std::vector<double> f;
for (int i=0;i<13;i++)f.push_back(1.0-cutoffinput)/12.0);


f[state]=cutoffinput;
node->Value()->SetSoftEvidence(f);
//proof
node->Value()->GetSoftEvidence(f);
for (int i=0;i<f.size();i++)
cout<<""<<f[i]<<endl;
}
}break;
case 2: 

int index=BNStorage[which]->theNet.FindNode("regionisColor");
if (index>=0){
DSL_node* node=BNStorage[which]->theNet.GetNode(index);
std::vector<double> f;
f.push_back(cutoffinput);f.push_back(1.0-cutoffinput);
node->Value()->SetSoftEvidence(f);
}
}break;
Martijn
Posts: 76
Joined: Sun May 29, 2011 12:23 am

Re: different results for Genie and Smile

Post by Martijn »

Ok.

Can you summarize the whole procedure for both your code and Genie?

Is it basically:

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?)
2. Run inference
3. Check probabilities (how do you check them in the code? how in Genie?)

I'm trying to understand the whole thing to see where things could go wrong.

Best,

Martijn
Post Reply