26 lines
526 B
Python
26 lines
526 B
Python
|
|
||
|
from bayes_net import *
|
||
|
|
||
|
# Exemplo dos acetatos:
|
||
|
|
||
|
bn = BayesNet()
|
||
|
|
||
|
bn.add('r',[],0.001)
|
||
|
bn.add('t',[],0.002)
|
||
|
|
||
|
bn.add('a',[('r',True ),('t',True )],0.950)
|
||
|
bn.add('a',[('r',True ),('t',False)],0.940)
|
||
|
bn.add('a',[('r',False),('t',True )],0.290)
|
||
|
bn.add('a',[('r',False),('t',False)],0.001)
|
||
|
|
||
|
bn.add('j',[('a',True )],0.900)
|
||
|
bn.add('j',[('a',False)],0.050)
|
||
|
|
||
|
bn.add('m',[('a',True )],0.700)
|
||
|
bn.add('m',[('a',False)],0.100)
|
||
|
|
||
|
conjunction = [('j',True),('m',True),('a',True),('r',False),('t',False)]
|
||
|
|
||
|
print(bn.jointProb(conjunction))
|
||
|
|