Inference

<< Click to Display Table of Contents >>

Navigation:  Using SMILE Wrappers >

Inference

SMILE includes functions for several popular Bayesian network inference algorithms, including the clustering algorithm and various approximate stochastic sampling algorithms. To run inference , or switch between algorithm implementations, use the following methods:

Python

update_beliefs()

set_bayesian_algorithm(algorithm_type: int) -> None

get_bayesian_algorithm() -> int

set_influence_diagram_algorithm(algorithm_type: int) -> None

get_influence_diagram_algorithm() -> int

get_sample_count() -> int

set_sample_count(sample_count: int) -> None
get_rand_seed() -> int

set_rand_seed(seed: int) -> None

Java

void updateBeliefs();

void setBayesianAlgorithm(int algorithmType);

int getBayesianAlgorithm();

void setInfluenceDiagramAlgorithm(int algorithmType);

int getSampleCount();

void setSampleCount(int sampleCount);

int getRandSeed();

void setRandSeed(int seed);

C#

void UpdateBeliefs()

int BayesianAlgorithm { get; set; }

int InfluenceDiagramAlgorithm { get; set; }

int SampleCount { get; set; }
int RandSeed { get; set; }

R

updateBeliefs()

setBayesianAlgorithm(algorithmType)

algorithmType <- getBayesianAlgorithm()

setInfluenceDiagramAlgorithm(algorithmType)

algorithmType <- getInfluenceDiagramAlgorithm()

sampleCount <- getSampleCount()

setSampleCount(sampleCount)

seed <- getRandSeed()

setRandSeed(seed)

 

The default algorithm for discrete Bayesian networks is clustering over a network preprocessed with relevance. The output of this algorithm is exact, unlike the results from various sampling algorithms. Sampling-based inference is stochastic and relies on a pseudorandom number generator, which by default is seeded from the system clock. To control the quality of approximation, the number of generated samples can be set with the Network.set_sample_count method. Naturally, generating more samples improves the approximation but increases computation time. For repeatable results across multiple runs, the random number generator can be explicitly seeded using Network.set_rand_seed with a non-zero value. This seed is stored in the network object and is used to initialize the generator before each inference call. If the seed is non-zero, it is also saved in the XDSL file, ensuring that the stochastic inference can be reproduced consistently when the network is reloaded.

Available Bayesian inference algorithms are:

LAURITZEN: the default exact clustering algorithm

HENRION: logic sampling

PEARL: Pearl’s algorithm for polytrees

L_SAMPLING: likelihood sampling

SELF_IMPORTANCE: self importance sampling

HEURISTIC_IMPORTANCE: heuristic importance sampling

BACK_SAMPLING: backward sampling

AIS_SAMPLING: adaptive importance sampling

EPIS_SAMPLING: EPIS sampling (recommended stochastic algorithm)

LBP: Loopy belief propagation

There are two algorithms for influence diagrams:

POLICY_EVALUATION: evaluates all decisions, this is the default for influence diagrams

FIND_BEST_POLICY: finds best decision

For detailed descriptions, theoretical background, and references, see the GeNIe manual.