void EquationToTable_bn ( node_bn*  node,   int  num_samples,   bool_ns  samp_unc,   bool_ns  add_exist )

Builds the CPT for node based on the equation that has been associated with it (see SetNodeEquation_bn).

num_samples is the number of samples to make per parent condition. The higher the number, the more accurate the conversion will be, but the longer it will take. If node and its parents are discrete, then it only takes one sample to generate an exact probability, and so in that case this argument is ignored.

samp_unc indicates whether to include in the generated probability table the uncertainty due to the sampling process or not. If the equations are simple (don't have narrow spikes), and the value passed for num_samples is high enough, it is better to make this argument FALSE, so that the CPT entries for 'impossible' are zero, rather than close to zero. Otherwise make it TRUE.

Normally you pass FALSE for add_exist, but you can pass TRUE if you wish the new sampling to be added to the table which already exists. If the equation conversion to table is nondeterministic (i.e., requires sampling), then calling this function twice with add_exist = TRUE is equivalent to calling it once with a value of num_samples twice as large. So you can increase the accuracy of the conversion in small steps by repeatedly calling with add_exist = TRUE. Or if you want to blend equations (say you want to indicate a 30% chance of equation 1 and a 70% chance of equation 2), you can call it twice, first setting equation 1 and using num_samples = 3, then setting equation 2 and using num_samples = 7. Similarly, you can blend equations with learned probabilities (see ReviseCPTsByCaseFile_bn), and those entered manually with SetNodeProbs_bn and SetNodeExperience_bn.


Versions 1.18 and later have this function.

See also:

SetNodeEquation_bn    Specifies the equation to be used
GetNodeProbs_bn    Retrieve the table, if its probabilistic
GetNodeFuncState_bn    Retrieve the table, if its deterministic discrete
GetNodeFuncReal_bn    Retrieve the table, if its deterministic continuous