This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/examples/learning/prof_params.pfl

48 lines
778 B
Plaintext
Raw Normal View History

2012-12-12 15:16:30 +00:00
/* Learn distribution for professor database. */
2012-07-03 19:48:13 +01:00
:- use_module(library(pfl)).
:- use_module(library(clpbn/learning/em)).
%:- set_em_solver(ve).
2012-12-17 21:19:47 +00:00
%:- set_em_solver(hve).
%:- set_em_solver(bdd).
%:- set_em_solver(bp).
%:- set_em_solver(cbp).
2012-12-12 15:16:30 +00:00
professor(p0).
professor(p1).
professor(p2).
professor(p3).
professor(p4).
professor(p5).
professor(p6).
professor(p7).
professor(p8).
2012-07-03 19:48:13 +01:00
bayes abi(K)::[h,m,l] ; abi_table ; [professor(K)].
bayes pop(K)::[h,m,l], abi(K) ; pop_table ; [professor(K)].
2012-12-12 15:16:30 +00:00
abi_table([0.3, 0.3, 0.4]).
2012-07-03 19:48:13 +01:00
2012-12-12 15:16:30 +00:00
pop_table([0.3, 0.3, 0.4, 0.3, 0.3, 0.4, 0.3, 0.3, 0.4]).
2012-07-03 19:48:13 +01:00
2012-12-12 15:16:30 +00:00
goal_list([
abi(p0,h),
2012-07-03 19:48:13 +01:00
abi(p1,m),
abi(p2,m),
2012-12-12 15:16:30 +00:00
abi(p3,m),
2012-08-13 15:23:36 +01:00
abi(p4,l),
2012-07-03 19:48:13 +01:00
pop(p5,h),
abi(p5,_),
abi(p6,_),
2013-01-11 00:16:56 +00:00
pop(p7,_)
]).
2012-07-03 19:48:13 +01:00
2013-01-11 00:16:56 +00:00
main :-
2012-07-03 19:48:13 +01:00
goal_list(L),
2013-01-11 00:16:56 +00:00
em(L, 0.01, 10, CPTs, Lik),
writeln(Lik:CPTs).
2012-07-03 19:48:13 +01:00