update examples
This commit is contained in:
parent
56475cacbc
commit
185cbe9c73
@ -1,26 +1,24 @@
|
|||||||
:- use_module(library(pfl)).
|
:- use_module(library(pfl)).
|
||||||
|
|
||||||
:- clpbn_horus:set_solver(fove).
|
%:- set_solver(fove).
|
||||||
%:- clpbn_horus:set_solver(hve).
|
%:- set_solver(hve).
|
||||||
%:- clpbn_horus:set_solver(bp).
|
%:- set_solver(bp).
|
||||||
%:- clpbn_horus:set_solver(cbp).
|
%:- set_solver(cbp).
|
||||||
|
|
||||||
:- multifile people/2.
|
:- multifile people/2.
|
||||||
:- multifile ev/1.
|
:- multifile ev/1.
|
||||||
|
|
||||||
|
|
||||||
people(joe,nyc).
|
people(joe,nyc).
|
||||||
people(p2, nyc).
|
people(p2, nyc).
|
||||||
people(p3, nyc).
|
people(p3, nyc).
|
||||||
people(p4, nyc).
|
people(p4, nyc).
|
||||||
people(p5, nyc).
|
people(p5, nyc).
|
||||||
|
|
||||||
%ev(descn(p2, t)).
|
ev(descn(p2, t)).
|
||||||
ev(descn(p3, t)).
|
ev(descn(p3, t)).
|
||||||
ev(descn(p4, t)).
|
ev(descn(p4, t)).
|
||||||
ev(descn(p5, t)).
|
ev(descn(p5, t)).
|
||||||
|
|
||||||
|
|
||||||
bayes city_conservativeness(C)::[y,n] ; cons_table(C) ; [people(_,C)].
|
bayes city_conservativeness(C)::[y,n] ; cons_table(C) ; [people(_,C)].
|
||||||
|
|
||||||
bayes gender(P)::[m,f] ; gender_table(P) ; [people(P,_)].
|
bayes gender(P)::[m,f] ; gender_table(P) ; [people(P,_)].
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
:- use_module(library(pfl)).
|
:- use_module(library(pfl)).
|
||||||
|
|
||||||
:- clpbn_horus:set_solver(fove).
|
%:- set_solver(fove).
|
||||||
%:- clpbn_horus:set_solver(hve).
|
%:- set_solver(hve).
|
||||||
%:- clpbn_horus:set_solver(bp).
|
%:- set_solver(bp).
|
||||||
%:- clpbn_horus:set_solver(cbp).
|
%:- set_solver(cbp).
|
||||||
|
|
||||||
:- yap_flag(write_strings, off).
|
:- yap_flag(write_strings, off).
|
||||||
|
|
||||||
|
:- multifile c/2.
|
||||||
|
|
||||||
c(p1,w1).
|
c(p1,w1).
|
||||||
c(p1,w2).
|
c(p1,w2).
|
||||||
c(p1,w3).
|
c(p1,w3).
|
||||||
@ -23,9 +25,9 @@ c(p5,w1).
|
|||||||
c(p5,w2).
|
c(p5,w2).
|
||||||
c(p5,w3).
|
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], hot(W)::[t,f] ; [0.2, 0.8, 0.8, 0.8] ; [c(P,W)].
|
||||||
|
|
||||||
markov attends(P)::[t,f], series::[t,f] ; [0.5, 0.6, 0.7, 0.8] ; [c(P,_)].
|
markov attends(P)::[t,f], series::[t,f] ; [0.501, 0.499, 0.499, 0.499] ; [c(P,_)].
|
||||||
|
|
||||||
% ?- series(X).
|
% ?- series(X).
|
||||||
|
|
||||||
|
@ -1,24 +1,31 @@
|
|||||||
:- use_module(library(pfl)).
|
:- use_module(library(pfl)).
|
||||||
|
|
||||||
:- clpbn_horus:set_solver(fove).
|
%:- set_solver(fove).
|
||||||
%:- clpbn_horus:set_solver(hve).
|
%:- set_solver(hve).
|
||||||
%:- clpbn_horus:set_solver(bp).
|
%:- set_solver(bp).
|
||||||
%:- clpbn_horus:set_solver(cbp).
|
%:- set_solver(cbp).
|
||||||
|
|
||||||
:- yap_flag(write_strings, off).
|
:- yap_flag(write_strings, off).
|
||||||
|
|
||||||
|
:- multifile people/1.
|
||||||
|
|
||||||
friends(P1, P2) :-
|
people @ 5.
|
||||||
people(P1),
|
|
||||||
people(P2),
|
|
||||||
P1 @< P2.
|
|
||||||
|
|
||||||
people @ 3.
|
friendship(X,Y) :-
|
||||||
|
people(X),
|
||||||
|
people(Y).
|
||||||
|
% X \== Y.
|
||||||
|
|
||||||
markov smokes(P)::[t,f], cancer(P)::[t,f] ; [0.1, 0.2, 0.3, 0.4] ; [people(P)].
|
markov smokes(X)::[t,f] ; [1.0, 1.4] ; [people(X)].
|
||||||
|
|
||||||
markov friend(P1,P2)::[t,f], smokes(P1)::[t,f], smokes(P2)::[t,f] ;
|
markov asthma(X)::[t,f] ; [1.0, 2.3] ; [people(X)].
|
||||||
[0.5, 0.6, 0.7, 0.8, 0.5, 0.6, 0.7, 0.8] ; [friends(P1, P2)].
|
|
||||||
|
|
||||||
% ?- smokes(p1, t), smokes(p2, f), friend(p1, p2, X).
|
markov friends(X,Y)::[t,f] ; [1.0, 4.6] ; [friendship(X,Y)].
|
||||||
|
|
||||||
|
markov asthma(X)::[t,f], smokes(X)::[t,f] ; [1.5, 1.0, 1.5, 1.5] ; [people(X)].
|
||||||
|
|
||||||
|
markov asthma(X)::[t,f], friends(X,Y)::[t,f], smokes(Y)::[t,f] ;
|
||||||
|
[1.1, 1.0, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1] ; [friendship(X,Y)].
|
||||||
|
|
||||||
|
% ?- smokes(p1,t), smokes(p2,t), friends(p1,p2,X)
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
:- use_module(library(pfl)).
|
:- use_module(library(pfl)).
|
||||||
|
|
||||||
:- clpbn_horus:set_solver(fove).
|
%:- set_solver(fove).
|
||||||
%:- clpbn_horus:set_solver(hve).
|
%:- set_solver(hve).
|
||||||
%:- clpbn_horus:set_solver(bp).
|
%:- set_solver(bp).
|
||||||
%:- clpbn_horus:set_solver(cbp).
|
%:- set_solver(cbp).
|
||||||
|
|
||||||
:- yap_flag(write_strings, off).
|
:- yap_flag(write_strings, off).
|
||||||
|
|
||||||
|
:- multifile people/1.
|
||||||
|
|
||||||
people @ 5.
|
people @ 5.
|
||||||
|
|
||||||
markov attends(P)::[t,f], attr1::[t,f] ; [0.7, 0.3, 0.3, 0.3] ; [people(P)].
|
markov attends(P)::[t,f], attr1::[t,f] ; [0.7, 0.3, 0.3, 0.3] ; [people(P)].
|
||||||
|
Reference in New Issue
Block a user