reasoning under uncertainty probdbn py -(continued #df dbnvefilter(dbn #df observe({ :true})df advance()df observe({ :false}#df query( # ( | , #df advance()df query( #dfa dbnvefilter(dbn_andfa observe({mic : mic : mic : }dfa advance(dfa observe({mic : mic : mic : }dfa query(pos_ causal models causal model can answer "doquestions the following adds the querydo method to the inferencemethod classso it can be used with any inference method probdo py -probabilistic inference with the do operator from probgraphicalmodels import inferencemethodbeliefnetwork from probfactors import cpdconstantcpd def querydo(selfqvarobs={}do={})assert isinstance(self gmbeliefnetwork)"do only applies to belief networksif do=={}return self query(qvarobselsenewfacs ({ for (ch,fin self gm var cpt items(if ch not in do{constantcpd( ,cfor ( ,cin do items()}self modbn beliefnetwork(self gm title+"(mod)"self gm variablesnewfacsoldbnself gm self gmself modbn result self query(qvarobsself gm oldbn restore original return result inferencemethod querydo querydo from probrc import probrc probdo py -(continued from probgraphicalmodels import bn_sprinklerseasonsprinklerrainedgrass_wetgrass_shinyshoes_wetbn_sprinkler_soff bn_sprinklerv probrc(bn_sprinkler#bn_sprinklerv querydo(shoes_wet#bn_sprinklerv querydo(shoes_wet,obs={sprinkler:"off"}#bn_sprinklerv querydo(shoes_wet,do={sprinkler:"off"}version june