<< Click to Display Table of Contents >> Navigation: Using SMILE > Inference |
SMILE includes functions for several popular Bayesian network inference algorithms, including the clustering algorithm, and several approximate stochastic sampling algorithms. To run the inference, use DSL_network::UpdateBeliefs method.
The default algorithm for discrete Bayesian networks is clustering over network pre-processed with relevance. To change the default Bayesian network algorithm, call DSL_network::SetDefaultBNAlgorithm and pass the chosen algorithm identifier as its parameter. For influence diagrams, the method is DSL_network::SetDefaultIDAlgorithm. Available algorithms are listed in the reference section for these methods.
DSL_network::UpdateBeliefs returns DSL_OUT_OF_MEMORY error code if the temporary data structures required to complete the inference require more memory than that available. In such case, or if the inference takes too long, consider taking advantage of SMILE's relevance reasoning layer. Relevance reasoning runs as a pre-processing step, which can lessen the complexity of later stages of inference algorithms. Relevance reasoning takes the target node set into account, therefore, to reduce the workload you should reduce the number of nodes set as targets if possible. Note that by default all nodes are targets (this is the case when no nodes were marked as such). If your network has 1,000 nodes and you only need the probabilities of 20 nodes, by all means call DSL_network::SetTarget on these nodes.
If changing the model to use Noisy-MAX nodes is possible, then it is definitely worth trying. The inference can be performed efficiently on networks with Noisy-MAX nodes when Noisy-MAX decomposition is enabled. To enable it, call DSL_network::EnableNoisyDecomp. If enabled, the Noisy-MAX decomposition runs in the relevance layer and reduces the complexity of the subsequent phases of the inference algorithm. To further control the decomposition, you can call DSL_network::SetNoisyDecompLimit, which controls the maximal number of parents in the temporary structures managed by SMILE during inference.
Stochastic inference algorithms can be controlled by setting the number of generated samples with the DSL_network::SetNumberOfSamples method. Obviously, the more samples are generated, the more time it takes to complete the inference. The accuracy of posterior marginal probabilities changes with a square root of the number of samples.
To obtain the probability of evidence currently set in the network, call DSL_network::CallProbEvidence.
Confidence intervals for specific nodes can be calculated with DSL_network::CalcConfidenceIntervals.