new version.

This commit is contained in:
tgomes 2012-03-29 12:24:29 +01:00
parent 32167b5465
commit 24b466db4e
6 changed files with 30 additions and 123 deletions

View File

@ -0,0 +1,30 @@
:- use_module(library(pfl)).
%:- set_clpbn_flag(solver,ve).
%:- set_clpbn_flag(solver,bp), clpbn_bp:set_horus_flag(inf_alg,ve).
:- set_clpbn_flag(solver,fove).
c(p1,w1).
c(p1,w2).
c(p1,w3).
c(p2,w1).
c(p2,w2).
c(p2,w3).
c(p3,w1).
c(p3,w2).
c(p3,w3).
c(p4,w1).
c(p4,w2).
c(p4,w3).
c(p5,w1).
c(p5,w2).
c(p5,w3).
markov attends(P)::[t,f] , hot(W)::[t,f] ; [0.1, 0.2, 0.3, 0.4] ; [c(P,W)].
markov attends(P)::[t,f], series::[t,f] ; [0.5, 0.6, 0.7, 0.8] ; [c(P,_)].
?- series(X).

View File

@ -1,18 +0,0 @@
:- use_module(library(pfl)).
%:- set_clpbn_flag(solver,ve).
%:- set_clpbn_flag(solver,bp), clpbn_bp:set_horus_flag(inf_alg,ve).
:- set_clpbn_flag(solver,fove).
c(x1,y1).
%c(x1,y1).
%c(x2,y2).
bayes hot(Y)::[t,f] ; [0.2, 0.4] ; [c(_,Y)].
bayes attends(X)::[t,f] , hot(Y) ; [0.1, 0.2, 0.3, 0.4] ; [c(X,Y)].
bayes series::[t,f] , attends(X) ; [0.5, 0.6, 0.7, 0.8] ; [c(X,_)].

View File

@ -1,50 +0,0 @@
:- use_module(library(pfl)).
:- set_clpbn_flag(solver,fove).
c(x1,y1,z1).
c(x1,y1,z2).
c(x1,y1,z3).
c(x1,y1,z4).
c(x1,y1,z5).
c(x1,y1,z6).
c(x1,y1,z7).
c(x1,y2,z1).
c(x1,y2,z2).
c(x1,y2,z3).
c(x1,y2,z4).
c(x1,y2,z5).
c(x1,y2,z6).
c(x1,y2,z7).
c(x2,y1,z1).
c(x2,y1,z2).
c(x2,y1,z3).
c(x2,y1,z4).
c(x2,y1,z5).
c(x2,y1,z6).
c(x2,y1,z7).
c(x2,y2,z1).
c(x2,y2,z2).
c(x2,y2,z3).
c(x2,y2,z4).
c(x2,y2,z5).
c(x2,y2,z6).
c(x2,y2,z7).
bayes p(X,Y,Z)::[t,f] , q(Y), s(Z) ; cpt ; [c(X,Y,Z)].
bayes q(Y)::[t,f] ; [0.50, 0.40] ; [c(_,Y,_)].
bayes s(Z)::[t,f] ; [0.33, 0.46] ; [c(_,_,Z)].
cpt([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]).
?- p(x1,y1,z1,X), s(z1,t), s(z3,f).

View File

@ -1,16 +0,0 @@
:- use_module(library(pfl)).
:- set_clpbn_flag(solver,fove).
t(ann).
t(dave).
bayes p(X)::[t,f] ; [0.1, 0.3] ; [t(X)].
% use standard Prolog queries: provide evidence first.
?- p(ann,f), p(ann,X).

View File

@ -1,16 +0,0 @@
:- use_module(library(pfl)).
:- set_clpbn_flag(solver,fove).
t(ann).
t(dave).
bayes p(X)::[t,f] ; [0.1, 0.3] ; [t(X)].
p(ann,t).
?- p(dave,X).

View File

@ -1,23 +0,0 @@
:- use_module(library(pfl)).
:- set_clpbn_flag(solver,fove).
t(ann).
t(dave).
t(lucy).
t(john).
t(kristian).
t(sriraam).
markov p(X)::[t,f] ; [0.1, 0.3] ; [t(X)].
markov q(X)::[t,f], r(X)::[t,f] ; [0.9, 0.5, 0.5, 0.1] ; [t(X)].
markov q(X)::[t,f], p(X)::[t,f] ; [0.9, 0.5, 0.5, 0.1] ; [t(X)].
p(ann,t).
?- p(dave,X).