small fixes

This commit is contained in:
Vitor Santos Costa 2008-11-04 17:02:26 +00:00
parent e19a8eeb87
commit 3f491b8666
3 changed files with 6 additions and 15 deletions

View File

@ -78,13 +78,9 @@ init_gibbs_solver(GoalVs, Vs0, _, Vs) :-
run_gibbs_solver(LVs, LPs, Vs) :-
initialise(Vs, Graph, LVs, OutputVars, VarOrder),
% writeln(Graph),
% write_pars(Vs),
process(VarOrder, Graph, OutputVars, Estimates),
% writeln(Estimates),
sum_up_all(Estimates, LPs),
clean_up.
% writeln(Estimates).
initialise(LVs, Graph, GVs, OutputVars, VarOrder) :-
init_keys(Keys0),

View File

@ -89,6 +89,7 @@ init_vel_solver_for_questions([], _, _, [], []).
init_vel_solver_for_questions([Vs|MVs], G, RG, [NVs|MNVs0], [NVs|LVis]) :-
influences(Vs, _, NVs0, G, RG),
sort(NVs0, NVs),
%clpbn_gviz:clpbn2gviz(user_error, test, NVs, Vs),
init_vel_solver_for_questions(MVs, G, RG, MNVs0, LVis).
run_vel_solver([], [], []).
@ -102,19 +103,8 @@ run_vel_solver([LVs|MoreLVs], [Ps|MorePs], [NVs0|MoreLVis]) :-
list_from_CPT(Dist, LPs),
normalise_CPT(Dist,MPs),
list_from_CPT(MPs, Ps),
lists:sumlist(Ps,SUM), ((SUM > 0.9 , SUM < 1.1) -> true ; writeln(LPs:Ps), get_els(LVs),writeln('--'), get_els(NVs0), abort),
run_vel_solver(MoreLVs, MorePs, MoreLVis).
get_els([]).
get_els(V.NVs0) :-
clpbn:get_atts(V,[key(K),evidence(El)]), !,
writeln(K:El),
get_els(NVs0).
get_els(V.NVs0) :-
clpbn:get_atts(V,[key(K)]),
writeln(K),
get_els(NVs0).
%
% just get a list of variables plus associated tables
%

View File

@ -1,5 +1,7 @@
% learn distribution for school database.
% we do not consider the aggregates yet.
:- [pos:train].
:- ['~/Yap/work/CLPBN/clpbn/examples/School/school_32'].
@ -11,6 +13,9 @@ main :-
em(L,0.01,10,CPTs,Lik),
writeln(Lik:CPTs).
%
% change to 0.05, 0.1, 0.2 to make things simpler/harder
%
missing(0.3).
% miss 30% of the examples.