remove some comments and improve em interface.
This commit is contained in:
parent
c159894c29
commit
2b2cedc2b6
@ -52,22 +52,21 @@
|
|||||||
|
|
||||||
|
|
||||||
call_horus_ground_solver(QueryVars, QueryKeys, AllKeys, Factors, Evidence, Output) :-
|
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).
|
clpbn_bind_vals([QueryVars], Solutions, Output).
|
||||||
|
|
||||||
call_horus_ground_solver_for_probabilities(QueryKeys, _AllKeys, Factors, Evidence, Solutions) :-
|
call_horus_ground_solver_for_probabilities(QueryKeys, _AllKeys, Factors, Evidence, Solutions) :-
|
||||||
attributes:all_attvars(AVars),
|
attributes:all_attvars(AVars),
|
||||||
keys(AVars, AllKeys),
|
keys(AVars, AllKeys),
|
||||||
writeln(AllKeys),
|
|
||||||
b_hash_new(Hash0),
|
b_hash_new(Hash0),
|
||||||
keys_to_ids(AllKeys, 0, Id1, Hash0, Hash1),
|
keys_to_ids(AllKeys, 0, Id1, Hash0, Hash1),
|
||||||
get_factors_type(Factors, Type),
|
get_factors_type(Factors, Type),
|
||||||
evidence_to_ids(Evidence, Hash1, Hash2, Id1, Id2, EvidenceIds),
|
evidence_to_ids(Evidence, Hash1, Hash2, Id1, Id2, EvidenceIds),
|
||||||
factors_to_ids(Factors, Hash2, Hash, Id2, _, FactorIds),
|
factors_to_ids(Factors, Hash2, Hash, Id2, _, FactorIds),
|
||||||
writeln(queryKeys:QueryKeys), writeln(''),
|
%% writeln(queryKeys:QueryKeys), writeln(''),
|
||||||
writeln(type:Type), writeln(''),
|
%% writeln(type:Type), writeln(''),
|
||||||
writeln(allKeys:AllKeys), writeln(''),
|
%% writeln(allKeys:AllKeys), writeln(''),
|
||||||
sort(AllKeys,SKeys),writeln(allSortedKeys:SKeys), writeln(''),
|
sort(AllKeys,SKeys), %% writeln(allSortedKeys:SKeys), writeln(''),
|
||||||
keys_to_ids(SKeys, 0, _, Hash0, Hash),
|
keys_to_ids(SKeys, 0, _, Hash0, Hash),
|
||||||
% writeln(factors:Factors), writeln(''),
|
% writeln(factors:Factors), writeln(''),
|
||||||
% writeln(factorIds:FactorIds), writeln(''),
|
% writeln(factorIds:FactorIds), writeln(''),
|
||||||
@ -95,7 +94,7 @@ run_solver(ground(Network,Hash), QueryKeys, Solutions) :-
|
|||||||
list_of_keys_to_ids(QueryKeys, Hash, _, _, _, QueryIds),
|
list_of_keys_to_ids(QueryKeys, Hash, _, _, _, QueryIds),
|
||||||
%writeln(queryKeys:QueryKeys), writeln(''),
|
%writeln(queryKeys:QueryKeys), writeln(''),
|
||||||
%writeln(queryIds:QueryIds), 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).
|
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)) :-
|
init_horus_ground_solver(QueryVars, _AllVars, _, horus(GKeys, Keys, Factors, Evidence)) :-
|
||||||
trace,
|
|
||||||
generate_networks(QueryVars, GKeys, [], Keys, [], Factors, [], Evidence),
|
generate_networks(QueryVars, GKeys, [], Keys, [], Factors, [], Evidence),
|
||||||
writeln(qvs:QueryVars),
|
writeln(qvs:QueryVars),
|
||||||
writeln(Keys), !.
|
writeln(Keys), writeln(Factors), !.
|
||||||
|
|
||||||
%
|
%
|
||||||
% as you add query vars the network grows
|
% as you add query vars the network grows
|
||||||
|
@ -118,8 +118,6 @@ ltables([Id-T|Tables], [Key-LTable|FTables]) :-
|
|||||||
get_dist_key(Id, Key),
|
get_dist_key(Id, Key),
|
||||||
ltables(Tables, FTables).
|
ltables(Tables, FTables).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
% collect the different dists we are going to learn next.
|
% collect the different dists we are going to learn next.
|
||||||
different_dists(AllVars, AllDists, AllInfo, MargVars) :-
|
different_dists(AllVars, AllDists, AllInfo, MargVars) :-
|
||||||
all_dists(AllVars, AllVars, Dists0),
|
all_dists(AllVars, AllVars, Dists0),
|
||||||
|
Reference in New Issue
Block a user