Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 1.37 KB

Enumeration-Ask.md

File metadata and controls

25 lines (21 loc) · 1.37 KB

ENUMERATION-ASK

AIMA3e

function ENUMERATION-ASK(X, e, bn) returns a distribution over X
inputs: X, the query variable
     e, observed values for variables E
     bn, a Bayes net with variables {X} ⋃ EY /* Y = hidden variables */

Q(X) ← a distribution over X, initially empty
for each value xi of X do
   Q(xi) ← ENUMERATE-ALL(bn.VARS, exi)
     where exi is e extended with X = xi
return NORMALIZE(Q(X))


function ENUMERATE-ALL(vars, e) returns a real number
if EMPTY?(vars) then return 1.0
Y ← FIRST(vars)
if Y has value y in e
   then return P(y | parents(Y)) × ENUMERATE-ALL(REST(vars), e)
   else returny P(y | parents(Y)) × ENUMERATE-ALL(REST(vars), ey)
     where ey is e extended with Y = y


Figure ?? The enumeration algorithm for answering queries on Bayesian networks.