BayesNet.generateCPTs

BayesNet.generateCPTs()

Randomly generates CPTs for a given structure.

Each distribution of a node (one per configuration of its parents) is drawn uniformly on the probability simplex, i.e. from a Dirichlet distribution of parameter 1.

Return type:

None

Example

import pyagrum as gum

gum.initRandom(42)
bn = gum.fastBN("A->B->C")
before = bn.cpt("C")[:].copy()
bn.generateCPTs()  # new random parameters for all the nodes
bool((bn.cpt("C")[:] != before).any())
# True
bn.check()
# ()

Class

BayesNet