This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/examples/sprinkler.pfl
2012-06-22 19:00:12 +01:00

34 lines
540 B
Plaintext

:- style_check(all).
:- ensure_loaded(library(pfl)).
% 1. define domain of random variables
% not necessary if they are boolean.
% 2. define parfactors
bayes cloudy ; cloudy_table ; [].
bayes sprinkler, cloudy ; sprinkler_table ; [].
bayes rain, cloudy ; rain_table ; [].
bayes wet_grass, sprinkler, rain ; wet_grass_table ; [].
% 3. define CPTs.
wet_grass_table([1.0,0.1,0.1,0.01,
0.0,0.9,0.9,0.99]).
sprinkler_table([0.5,0.9,
0.5,0.1]).
rain_table([0.8,0.2,
0.2,0.8]).
cloudy_table([0.5,0.5]).