Improve a bit the learning examples

This commit is contained in:
Tiago Gomes 2013-01-11 00:16:56 +00:00
parent 8285b8e1e4
commit 8c8e2b034f
4 changed files with 21 additions and 35 deletions

File diff suppressed because one or more lines are too long

View File

@ -29,25 +29,19 @@ abi_table([0.3, 0.3, 0.4]).
pop_table([0.3, 0.3, 0.4, 0.3, 0.3, 0.4, 0.3, 0.3, 0.4]).
goal_list([
/*
abi(p0,h),
abi(p1,m),
abi(p2,m),
abi(p3,m),
*/
abi(p4,l),
pop(p5,h),
abi(p5,_),
abi(p6,_),
pop(p7,_)]).
pop(p7,_)
]).
timed_main :-
statistics(runtime, _),
main(Lik),
statistics(runtime, [T,_]),
format('Took ~d msec and Lik ~3f~n',[T,Lik]).
main(Lik) :-
main :-
goal_list(L),
em(L,0.01,10,_,Lik).
em(L, 0.01, 10, CPTs, Lik),
writeln(Lik:CPTs).

View File

@ -2,12 +2,12 @@
/* We do not consider aggregates yet. */
:- use_module(library(clpbn/learning/em)).
:- [pos:train].
:- ['../../examples/School/school_32'].
:- use_module(library(clpbn/learning/em)).
%:- set_em_solver(ve).
%:- set_em_solver(hve).
%:- set_em_solver(bdd).
@ -16,14 +16,14 @@
timed_main :-
statistics(runtime, _),
findall(X,goal(X),L),
em(L,0.01,10,_,Lik),
findall(X, goal(X), L),
em(L, 0.01, 10, _, Lik),
statistics(runtime, [T,_]),
format('Took ~d msec and Lik ~3f~n',[T,Lik]).
main :-
findall(X,goal(X),L),
em(L,0.001,10,CPTs,Lik),
em(L, 0.01, 10, CPTs, Lik),
writeln(Lik:CPTs).
%

View File

@ -10,8 +10,6 @@
%:- set_em_solver(bp).
%:- set_em_solver(cbp).
:- dynamic id/1.
data(t,t,t,t).
data(_,t,_,t).
data(t,t,f,f).
@ -26,17 +24,11 @@ data(t,t,_,f).
data(t,f,f,t).
data(t,f,t,t).
timed_main :-
statistics(runtime, _),
main(Lik),
statistics(runtime, [T,_]),
format('Took ~d msec and Lik ~3f~n',[T,Lik]).
main(Lik) :-
findall(X,scan_data(X),L),
em(L,0.01,10,_,Lik).
scan_data([wet_grass(W),sprinkler(S),rain(R),cloudy(C)]) :-
data(W, S, R, C).
main :-
findall(X, scan_data(X), L),
em(L, 0.01, 10, CPTs, Lik),
writeln(Lik:CPTs).
scan_data([cloudy(C),sprinkler(S),rain(R),wet_grass(W)]) :-
data(C, S, R, W).