convert city dataset to new format

This commit is contained in:
Tiago Gomes 2012-04-10 12:56:14 +01:00
parent b52dc99914
commit 46e6a10625
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,21 @@
bayes conservative_city(C)::[y,n] ; cons_table(C) ; [city(C)].
bayes gender(P)::[m,f] ; gender_table(P) ; [people(P,_)].
bayes hair_color(P)::[t,f] , conservative_city(C) ; hair_color_table(P) ; [people(P,C)].
bayes car_color(P)::[t,f] , hair_color(P) ; car_color_table(P); [people(P,_)].
bayes height(P)::[t,f] , gender(P) ; height_table(P) ; [people(P,_)].
bayes shoe_size(P):[t,f] , height(P) ; shoe_size_table(P); [people(P,_)].
bayes guilty(P)::[y,n] ; guilty_table(P) ; [people(P,_)].
bayes descn(P)::[t,f] , car_color(P), hair_color(P), height(P), guilty(P) ; descn_table(P) ; [people(P,_)].
bayes witness(C)::[t,f] , descn(Joe) , descn(P2) ; wit_table ; [city(C), Joe=joe, P2=p2].
:- ensure_loaded(tables).

View File

@ -0,0 +1,47 @@
:- source.
:- style_check(all).
:- yap_flag(unknown,error).
:- yap_flag(write_strings,on).
:- use_module(library(clpbn)).
%:- set_clpbn_flag(solver, bp).
:- set_clpbn_flag(solver,fove).
:- [-parschema].
run_query(Guilty) :-
guilty(joe, Guilty),
witness(nyc, t).
%runall(X, ev(X)).
runall(G, Wrapper) :-
findall(G, Wrapper, L),
execute_all(L).
execute_all([]).
execute_all(G.L) :-
call(G),
execute_all(L).
%ev(descn(p2, t)).
%ev(descn(p3, t)).
city(nyc).
city(oporto).
people(joe,nyc).
people(p2,nyc).
people(p3,nyc).
%people(p4,nyc).
%people(p5,nyc).
%people(p6,nyc).
%people(p7,nyc).
%people(p8,nyc).
%people(p9,nyc).