/* CSI (Context-specific independence) in Picat. From BLOG example/csi: """ Model that illustrates context-specific independence. This is a parameterization of the model shown in Fig. 3 of (Milch et al., AISTATS 2005): X depends on W when U is true, but on V when U is false. The probability of X being true given no evidence is P(X=true) = 0.596. """ Cf my Gamble model gamble_csi.rkt This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils. import util. main => go. /* var : x Probabilities: true: 0.5988000000000000 false: 0.4012000000000000 mean = [true = 0.5988,false = 0.4012] */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths, % fail, nl. go => true. model() => U = flip(0.3), V = flip(0.9), W = flip(0.1), X = condt(U, condt(W,flip(0.8),flip(0.2)), condt(V,flip(0.8),flip(0.2))), add("x",X).