From 3f491b866689c1e6afd8a997be6671f3c534b937 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 4 Nov 2008 17:02:26 +0000 Subject: [PATCH] small fixes --- CLPBN/clpbn/gibbs.yap | 4 ---- CLPBN/clpbn/vel.yap | 12 +----------- CLPBN/learning/example/school_params.yap | 5 +++++ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/CLPBN/clpbn/gibbs.yap b/CLPBN/clpbn/gibbs.yap index 4b2e65d77..ecba78906 100644 --- a/CLPBN/clpbn/gibbs.yap +++ b/CLPBN/clpbn/gibbs.yap @@ -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), diff --git a/CLPBN/clpbn/vel.yap b/CLPBN/clpbn/vel.yap index 5e385d87b..8a823076a 100644 --- a/CLPBN/clpbn/vel.yap +++ b/CLPBN/clpbn/vel.yap @@ -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 % diff --git a/CLPBN/learning/example/school_params.yap b/CLPBN/learning/example/school_params.yap index 935797979..30fbdc513 100644 --- a/CLPBN/learning/example/school_params.yap +++ b/CLPBN/learning/example/school_params.yap @@ -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.