C++ vs GeNIe performance

The engine.
Post Reply
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

C++ vs GeNIe performance

Post by orzech »

Hello,

I've got a pretty big network which is being used in GeNIe and C++ code. The problem concerns computing test strengths in some certain cases of observations. When I use Diagnostic View in GeNIe the problematic case gets solved in miliseconds with no remarkable memory consumption (relevance enabled) but when I solve exactly the same case in C++ (Windows binary) it takes about 8 seconds and 2 GB of physical memory (!!!).

I have completly no idea of what's going on. Possible causes:
- There is a bug in my C++ code
- GeNIe uses different version of SMILE library
- GeNIe's Diagnostic View is smarter then standard usage described in docs
- There is a bug in SMILE C++ library (not likely?)

Here is what I do in my C++ code:

Code: Select all

// (...) instantiating observations
diagnet.GetNetwork().EnableNoisyMAXRelevance();
diagnet.EnableDSep(true);

diagnet->UpdateFaultBeliefs();
int mostLikelyFault = findMostLikelyFault(net, diagnet); // this one finds a fault that I'd like to pursue

diagnet->SetPursuedFault(mostLikelyFault);	
diagnet->ComputeTestStrengths();
Apart from this I use all default settings in C++ code. The most important thing are memory jumps which don't show up in GeNIe but kill native applications.

I'd be thankful for any advice since I've been stuck with this for a week now.

Kind regards,
orzech
shooltz[BayesFusion]
Site Admin
Posts: 1441
Joined: Mon Nov 26, 2007 5:51 pm

Re: C++ vs GeNIe performance

Post by shooltz[BayesFusion] »

Can you post your network here or send it as a private message?
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

Re: C++ vs GeNIe performance

Post by orzech »

OK I have to admit that there was a bug in my code and results in GeNIe and C++ ARE pretty comparable. Sorry for bothering this was obviously my fault. :(
Nonetheless, I'd be thankful if you could provide me answers for few questions:
1. Is DSeparation enabled by default in GeNIe and there is no mean to turn it off?
2. Is NoisyMaxRelevance disabled by default in Genie and there is no mean to turn it on?
3. Could you provide me some detailed information on what is a complexity criterium in case of getting the following message in GeNIe: Error (-42): UpdateBeliefs fails - network structure is too complex? Is it a trial of allocating a memory block ?...

Please notice that you we've got a subtle design issue in DSL_DiagNetwork class. UpdateFaultBeliefs() doesn not return any value / no error code. So in case internal UpdateBeliefs() returns -42 the user cannot know that. This is also a case with diagnostic window in GeNIe. Suddenly all targets and observations become 0 and you're not informed that OutOfMemory occurred.

Thanks in advance,
Piotr
shooltz[BayesFusion]
Site Admin
Posts: 1441
Joined: Mon Nov 26, 2007 5:51 pm

Re: C++ vs GeNIe performance

Post by shooltz[BayesFusion] »

1. Is DSeparation enabled by default in GeNIe and there is no mean to turn it off?
It's off by default and can be changed by selecting 'Enable relevance' from the Options menu in diagnostic window
2. Is NoisyMaxRelevance disabled by default in Genie and there is no mean to turn it on?
It's off by default. To enable it from GeNIe, add the DSL_NOISYMAXRELEVANCE user property to the network and make its value nonzero.
3. Could you provide me some detailed information on what is a complexity criterium in case of getting the following message in GeNIe: Error (-42): UpdateBeliefs fails - network structure is too complex? Is it a trial of allocating a memory block ?...
Error -42 comes from the triangulation phase. If you receive this error no memory blocks for cliques/sepsets have been allocated yet. OTOH, if you get std::bad_alloc it's likely that you'll get memory leaks (due to substantial amounts of legacy code in SMILE)
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

Re: C++ vs GeNIe performance

Post by orzech »

Thank you very much - your answer means a lot to me :)

So one more question if you don't mind to have a complete point of view - relevance is on by default in GeNIe and you cannot turn it off?
(Side question - what does 'Enable relevance' option does exactly? It turns on DSep and ... perhaps relevance?)

Cheers,
Piotr
shooltz[BayesFusion]
Site Admin
Posts: 1441
Joined: Mon Nov 26, 2007 5:51 pm

Re: C++ vs GeNIe performance

Post by shooltz[BayesFusion] »

orzech wrote:what does 'Enable relevance' option does exactly? It turns on DSep and ... perhaps relevance?)
'Enable relevance' option in the diagnostic window only toggles the DSep in the underlying DIAG_network object.
orzech
Posts: 51
Joined: Wed Aug 04, 2010 11:40 pm

Re: C++ vs GeNIe performance

Post by orzech »

So relevance itself is always on in GeNIe?

Dziekuje i pozdrawiam :)
shooltz[BayesFusion]
Site Admin
Posts: 1441
Joined: Mon Nov 26, 2007 5:51 pm

Re: C++ vs GeNIe performance

Post by shooltz[BayesFusion] »

orzech wrote:So relevance itself is always on in GeNIe?
If you mean the functionality controlled by DSL_network::ActivateRelevance and DSL_network::DeactivateRelevance, then the answer is affirmative. There's no GUI pathway in GeNIe which calls these methods directly (they may be called internally by SMILE, but the state change is temporary).
Post Reply