pyAgrum on notebooks
☰  aggregators

### Aggregators¶

Aggregators are special type of nodes that includes a generic CPT for any numbers of parents.

pyAgrum proposes a list of such aggregators. Some of then are used below.

In [1]:
import numpy as np

import pyAgrum as gum
import pyAgrum.lib.notebook as gnb

In [2]:
bn=gum.BayesNet()

In [3]:
nmax=bn.addMAX(gum.RangeVariable("MAX","MAX",0,15))

for n in [l[0],l[1],l[2],l[3]]:
#potential for median has a size : 16^5=2^20 double !


In [4]:
for nod in l:
bn.cpt(nod)[:]=np.ones(16)/16
gnb.showInference(bn,size="12")

In [5]:
# if I know that the median is between 8 and 13 ...
gnb.showInference(bn,evs={'MEDIAN':[0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0]},size="12")

In [6]:
# if the roots do not have uniform but random distribution
for nod in l:
bn.generateCPT(nod)

gnb.showInference(bn,size="12")