start with pfl learning.

This commit is contained in:
Vitor Santos Costa
2012-06-22 19:00:12 +01:00
parent 5fe052a3ef
commit 87e0b67e76
10 changed files with 141 additions and 14 deletions

View File

@@ -0,0 +1,33 @@
:- 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]).