From 2b2cedc2b66dcb0cd2bedd396cf4870a68a928c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 7 Aug 2012 21:53:10 -0500 Subject: [PATCH] remove some comments and improve em interface. --- packages/CLPBN/clpbn/horus_ground.yap | 16 +++++++--------- packages/CLPBN/learning/em.yap | 2 -- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/CLPBN/clpbn/horus_ground.yap b/packages/CLPBN/clpbn/horus_ground.yap index 3c500ae62..7de683f09 100644 --- a/packages/CLPBN/clpbn/horus_ground.yap +++ b/packages/CLPBN/clpbn/horus_ground.yap @@ -52,22 +52,21 @@ call_horus_ground_solver(QueryVars, QueryKeys, AllKeys, Factors, Evidence, Output) :- - call_horus_ground_solver_for_probabilities(QueryKeys, AllKeys, Factors, Evidence, Solutions), + call_horus_ground_solver_for_probabilities([QueryKeys], AllKeys, Factors, Evidence, Solutions), clpbn_bind_vals([QueryVars], Solutions, Output). call_horus_ground_solver_for_probabilities(QueryKeys, _AllKeys, Factors, Evidence, Solutions) :- attributes:all_attvars(AVars), keys(AVars, AllKeys), -writeln(AllKeys), b_hash_new(Hash0), keys_to_ids(AllKeys, 0, Id1, Hash0, Hash1), get_factors_type(Factors, Type), evidence_to_ids(Evidence, Hash1, Hash2, Id1, Id2, EvidenceIds), factors_to_ids(Factors, Hash2, Hash, Id2, _, FactorIds), - writeln(queryKeys:QueryKeys), writeln(''), - writeln(type:Type), writeln(''), - writeln(allKeys:AllKeys), writeln(''), - sort(AllKeys,SKeys),writeln(allSortedKeys:SKeys), writeln(''), + %% writeln(queryKeys:QueryKeys), writeln(''), + %% writeln(type:Type), writeln(''), + %% writeln(allKeys:AllKeys), writeln(''), + sort(AllKeys,SKeys), %% writeln(allSortedKeys:SKeys), writeln(''), keys_to_ids(SKeys, 0, _, Hash0, Hash), % writeln(factors:Factors), writeln(''), % writeln(factorIds:FactorIds), writeln(''), @@ -95,7 +94,7 @@ run_solver(ground(Network,Hash), QueryKeys, Solutions) :- list_of_keys_to_ids(QueryKeys, Hash, _, _, _, QueryIds), %writeln(queryKeys:QueryKeys), writeln(''), %writeln(queryIds:QueryIds), writeln(''), - cpp_run_ground_solver(Network, [QueryIds], Solutions). + cpp_run_ground_solver(Network, QueryIds, Solutions). keys_to_ids([], Id, Id, Hash, Hash). @@ -167,10 +166,9 @@ finalize_horus_ground_solver(bp(Network, _)) :- % % init_horus_ground_solver(QueryVars, _AllVars, _, horus(GKeys, Keys, Factors, Evidence)) :- - trace, generate_networks(QueryVars, GKeys, [], Keys, [], Factors, [], Evidence), writeln(qvs:QueryVars), - writeln(Keys), !. + writeln(Keys), writeln(Factors), !. % % as you add query vars the network grows diff --git a/packages/CLPBN/learning/em.yap b/packages/CLPBN/learning/em.yap index 7a3196d92..0e2bb3efe 100644 --- a/packages/CLPBN/learning/em.yap +++ b/packages/CLPBN/learning/em.yap @@ -117,8 +117,6 @@ ltables([Id-T|Tables], [Key-LTable|FTables]) :- matrix_to_list(T,LTable), get_dist_key(Id, Key), ltables(Tables, FTables). - - % collect the different dists we are going to learn next. different_dists(AllVars, AllDists, AllInfo, MargVars) :-