reasoning under uncertainty projfactors self eliminate_var(projfactors,vunnorm factor_times(var,projfactorsp_obs=sum(unnormself display( ,"unnormalized probs:",unnorm,"prob obs:",p_obsreturn {val:pr/p_obs for val,pr in zip(var domainunnorm) factorobserved is factor that is the result of some observations on another factor we don' store the values in listwe just look them up as needed the observations can include variables that are not in the listbut should have some intersection with the variables in the factor probfactors py -(continued class factorobserved(factor)def __init__(self,factor,obs)factor __init__(self[ for in factor variables if not in obs]self observed obs self orig_factor factor def get_value(self,assignment)ass assignment copy(for ob in self observedass[ob]=self observed[obreturn self orig_factor get_value(assa factorsum is factor that is the result of summing out variable from the product of other factors it constructs representation off var factors we store the values in list in lazy mannerif they are already computedwe used the stored values if they are not already computed we can compute and store them probfactors py -(continued class factorsum(factor)def __init__(self,var,factors)self var_summed_out var self factors factors vars [for fac in factorsfor in fac variablesif is not var and not in varsvars append(vfactor __init__(self,varsself values { def get_value(self,assignment)"""lazy implementationif not savedcompute it return saved value""asst frozenset(assignment items()version june