Getting nan using GetSampleMean() and GetSampleStdDev()

The engine.
Post Reply
sebastian
Posts: 4
Joined: Thu Nov 02, 2017 11:47 am

Getting nan using GetSampleMean() and GetSampleStdDev()

Post by sebastian » Sat Nov 25, 2017 1:11 pm

Hello all,

I have a hybrid network with equation nodes. I need the mean and standard deviation of an equation node. Therefore I looked in this topic.

http://support.bayesfusion.com/forum/vi ... tion#p3849

That is my code which refers to the topic above.

handle = net.FindNode("a");
DSL_valEqEvaluation* val =(DSL_valEqEvaluation*)(net.GetNode(handle)->Value());
if(net.GetNode(handle)->Value->IsValueValid())
{
double mean = val->GetSampleMean();
double stddev = val->GetSampleStdDev();
cout<<mean<<" "<<stddev<<endl;
}

The double values contain not a number and I don't get any error.

Best regards,

Sebastian

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

Re: Getting nan using GetSampleMean() and GetSampleStdDev()

Post by shooltz[BayesFusion] » Mon Nov 27, 2017 5:21 pm

If you have evidence set on a node with parents, the discretization occurs. In such case node value is represented by discretized beliefs, which you can acces through DSL_valEqEvaluation::GetDiscBeliefs. The method returns a reference to a vector. The vector is non-empty if node was discretized.

Note that discretization is done even if you did not specify the intervals - in such case two intervals are automatically generated.

Post Reply