2008-10-22 00:44:02 +01:00
|
|
|
% learn distribution for school database.
|
|
|
|
|
|
|
|
:- [pos:train].
|
|
|
|
|
|
|
|
:- ['~/Yap/work/CLPBN/clpbn/examples/School/school_32'].
|
|
|
|
|
|
|
|
:- ['~/Yap/work/CLPBN/learning/em'].
|
|
|
|
|
|
|
|
main :-
|
|
|
|
findall(X,goal(X),L),
|
2008-11-02 15:59:41 +00:00
|
|
|
em(L,0.01,10,CPTs,Lik),
|
2008-10-22 00:44:02 +01:00
|
|
|
writeln(Lik:CPTs).
|
|
|
|
|
2008-11-03 16:02:15 +00:00
|
|
|
missing(0.1).
|
2008-11-01 21:08:47 +00:00
|
|
|
|
2008-10-22 00:44:02 +01:00
|
|
|
% miss 30% of the examples.
|
|
|
|
goal(professor_ability(P,V)) :-
|
|
|
|
pos:professor_ability(P,V1),
|
2008-11-01 21:08:47 +00:00
|
|
|
missing(X),
|
|
|
|
( random > X -> V = V1 ; true).
|
2008-10-22 00:44:02 +01:00
|
|
|
% miss 10% of the examples.
|
|
|
|
goal(professor_popularity(P,V)) :-
|
|
|
|
pos:professor_popularity(P,V1),
|
2008-11-01 21:08:47 +00:00
|
|
|
missing(X),
|
|
|
|
( random > X -> V = V1 ; true).
|
2008-10-22 00:44:02 +01:00
|
|
|
goal(registration_grade(P,V)) :-
|
|
|
|
pos:registration_grade(P,V1),
|
2008-11-01 21:08:47 +00:00
|
|
|
missing(X),
|
|
|
|
( random > X -> V = V1 ; true).
|
2008-10-22 00:44:02 +01:00
|
|
|
goal(student_intelligence(P,V)) :-
|
|
|
|
pos:student_intelligence(P,V1),
|
2008-11-01 21:08:47 +00:00
|
|
|
missing(X),
|
|
|
|
( random > X -> V = V1 ; true).
|
2008-10-22 00:44:02 +01:00
|
|
|
goal(course_difficulty(P,V)) :-
|
|
|
|
pos:course_difficulty(P,V1),
|
2008-11-01 21:08:47 +00:00
|
|
|
missing(X),
|
|
|
|
( random > X -> V = V1 ; true).
|
2008-10-22 00:44:02 +01:00
|
|
|
goal(registration_satisfaction(P,V)) :-
|
2008-11-01 21:08:47 +00:00
|
|
|
pos:registration_satisfaction(P,V1),
|
|
|
|
missing(X),
|
|
|
|
( random > X -> V = V1 ; true).
|