- edited description
Add prior_lea argument to switch and if_ methods
In some situations, several entries in CPT are unknown but a prior (unconditional) probabilities are knwon. Lea provides the revised_with_cpt
for such case.
c = event(0.034)
a1 = event(0.92).revised_with_cpt((c, event(0.19)))
print (P(a1))
# -> 0.92
print (P(a1.given(c))
# -> 0.19
However this method, beside being not very intutive, produces a Blea
instance (clause-oriented CPT), which may be inefficient.
As alternative, it is proposed to add an optional prior_lea
argument to switch
method. This argument should be an alternative to the optional default_lea
argument. prior_lea
defines the prior unconditional probabilities, from which the default_lea
can be calculated. The same optional argument can be added to if_
method, as alternative to else_lea
. Then, the following defintions shall be functionally equivalent to the previous one (althouth they produce Tlea instances instead of Blea instances):
a2 = c.switch({True:event(0.19)}, prior_lea=event(0.92))
print (P(a2))
# -> 0.92
print (P(a2.given(c)))
# -> 0.19
a3 = if_(c, event(0.19), prior_lea=event(0.92))
print (P(a3))
# -> 0.92
print (P(a3.given(c)))
# -> 0.19
Comments (5)
-
reporter -
reporter Add prior_lea argument to Lea.switch and Lea.if_ methods; add Tlea.build method (refs
#53)→ <<cset 17294775bc1a>>
-
reporter - changed status to resolved
-
reporter Add prior_lea argument to Lea.switch and Lea.if_ methods; add Tlea.build method (refs
#53)→ <<cset 889ee8205dd3>>
-
reporter - changed status to closed
- Log in to comment