Use the same convetion for module import and export
This commit is contained in:
parent
2738c0fb56
commit
409a230826
@ -116,7 +116,6 @@
|
|||||||
:- use_module('clpbn/graphviz',
|
:- use_module('clpbn/graphviz',
|
||||||
[clpbn2gviz/4]).
|
[clpbn2gviz/4]).
|
||||||
|
|
||||||
|
|
||||||
%
|
%
|
||||||
% avoid the overhead of using goal_expansion/2.
|
% avoid the overhead of using goal_expansion/2.
|
||||||
%
|
%
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
%
|
%
|
||||||
% generate explicit CPTs
|
% generate explicit CPTs
|
||||||
%
|
%
|
||||||
:- module(clpbn_aggregates, [
|
:- module(clpbn_aggregates,
|
||||||
check_for_agg_vars/2,
|
[check_for_agg_vars/2,
|
||||||
cpt_average/6,
|
cpt_average/6,
|
||||||
cpt_average/7,
|
cpt_average/7,
|
||||||
cpt_max/6,
|
cpt_max/6,
|
||||||
@ -10,7 +10,8 @@
|
|||||||
avg_factors/5
|
avg_factors/5
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn), [{}/1]).
|
:- use_module(library(clpbn),
|
||||||
|
[{}/1]).
|
||||||
|
|
||||||
:- use_module(library(lists),
|
:- use_module(library(lists),
|
||||||
[last/2,
|
[last/2,
|
||||||
@ -24,19 +25,21 @@
|
|||||||
:- use_module(library(matrix),
|
:- use_module(library(matrix),
|
||||||
[matrix_new/3,
|
[matrix_new/3,
|
||||||
matrix_to_list/2,
|
matrix_to_list/2,
|
||||||
matrix_set/3]).
|
matrix_set/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn/dists),
|
:- use_module(library(clpbn/dists),
|
||||||
[
|
[add_dist/6,
|
||||||
add_dist/6,
|
get_dist_domain_size/2
|
||||||
get_dist_domain_size/2]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn/matrix_cpt_utils),
|
:- use_module(library(clpbn/matrix_cpt_utils),
|
||||||
[normalise_CPT_on_lines/3]).
|
[normalise_CPT_on_lines/3]).
|
||||||
|
|
||||||
:- use_module(library(pfl),
|
:- use_module(library(pfl),
|
||||||
[skolem/2,
|
[skolem/2,
|
||||||
add_ground_factor/5]).
|
add_ground_factor/5
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(bhash)).
|
:- use_module(library(bhash)).
|
||||||
|
|
||||||
|
@ -1064,4 +1064,3 @@ build_cnf(CNF, IVs, Indics, AllParms, AllParmValues, Val) :-
|
|||||||
set_to_ones(Extra),
|
set_to_ones(Extra),
|
||||||
ddnnf_is(F, Val).
|
ddnnf_is(F, Val).
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,23 @@
|
|||||||
:- module(bnt, [do_bnt/3,
|
:- module(bnt,
|
||||||
|
[do_bnt/3,
|
||||||
create_bnt_graph/2,
|
create_bnt_graph/2,
|
||||||
check_if_bnt_done/1]).
|
check_if_bnt_done/1
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/display'), [
|
:- use_module(library('clpbn/display'),
|
||||||
clpbn_bind_vals/3]).
|
[clpbn_bind_vals/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'), [
|
:- use_module(library('clpbn/dists'),
|
||||||
get_dist_domain_size/2,
|
[get_dist_domain_size/2,
|
||||||
get_dist_domain/2,
|
get_dist_domain/2,
|
||||||
get_dist_params/2
|
get_dist_params/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/discrete_utils'), [
|
:- use_module(library('clpbn/discrete_utils'),
|
||||||
reorder_CPT/5]).
|
[reorder_CPT/5]).
|
||||||
|
|
||||||
:- use_module(library(matlab), [start_matlab/1,
|
:- use_module(library(matlab),
|
||||||
|
[start_matlab/1,
|
||||||
close_matlab/0,
|
close_matlab/0,
|
||||||
matlab_on/0,
|
matlab_on/0,
|
||||||
matlab_eval_string/1,
|
matlab_eval_string/1,
|
||||||
@ -27,7 +30,8 @@
|
|||||||
matlab_call/2
|
matlab_call/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(dgraphs), [dgraph_new/1,
|
:- use_module(library(dgraphs),
|
||||||
|
[dgraph_new/1,
|
||||||
dgraph_add_vertices/3,
|
dgraph_add_vertices/3,
|
||||||
dgraph_add_edges/3,
|
dgraph_add_edges/3,
|
||||||
dgraph_top_sort/2,
|
dgraph_top_sort/2,
|
||||||
@ -35,11 +39,13 @@
|
|||||||
dgraph_edges/2
|
dgraph_edges/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(lists), [append/3,
|
:- use_module(library(lists),
|
||||||
member/2,nth/3]).
|
[append/3,
|
||||||
|
member/2,nth/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(ordsets), [
|
:- use_module(library(ordsets),
|
||||||
ord_insert/3]).
|
[ord_insert/3]).
|
||||||
|
|
||||||
:- yap_flag(write_strings,on).
|
:- yap_flag(write_strings,on).
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
[influences/3,
|
[influences/3,
|
||||||
factor_influences/4,
|
factor_influences/4,
|
||||||
init_influences/3,
|
init_influences/3,
|
||||||
influences/4]
|
influences/4
|
||||||
).
|
]).
|
||||||
|
|
||||||
:- use_module(library(maplist)).
|
:- use_module(library(maplist)).
|
||||||
|
|
||||||
@ -14,13 +14,15 @@
|
|||||||
dgraph_add_vertex/3,
|
dgraph_add_vertex/3,
|
||||||
dgraph_neighbors/3,
|
dgraph_neighbors/3,
|
||||||
dgraph_edge/3,
|
dgraph_edge/3,
|
||||||
dgraph_transpose/2]).
|
dgraph_transpose/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(rbtrees),
|
:- use_module(library(rbtrees),
|
||||||
[rb_new/1,
|
[rb_new/1,
|
||||||
rb_lookup/3,
|
rb_lookup/3,
|
||||||
rb_insert/4,
|
rb_insert/4,
|
||||||
rb_visit/2]).
|
rb_visit/2
|
||||||
|
]).
|
||||||
|
|
||||||
factor_influences(Vs, QVars, Ev, LV) :-
|
factor_influences(Vs, QVars, Ev, LV) :-
|
||||||
init_factor_influences(Vs, G, RG),
|
init_factor_influences(Vs, G, RG),
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
|
|
||||||
:- module(discrete_utils, [project_from_CPT/3,
|
:- module(discrete_utils,
|
||||||
|
[project_from_CPT/3,
|
||||||
reorder_CPT/5,
|
reorder_CPT/5,
|
||||||
get_dist_size/2]).
|
get_dist_size/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn/dists), [get_dist_domain_size/2,
|
:- use_module(library(clpbn/dists),
|
||||||
get_dist_domain/2]).
|
[get_dist_domain_size/2,
|
||||||
|
get_dist_domain/2
|
||||||
|
]).
|
||||||
%
|
%
|
||||||
% remove columns from a table
|
% remove columns from a table
|
||||||
%
|
%
|
||||||
@ -143,4 +147,3 @@ get_sizes([V|Deps], [Sz|Sizes]) :-
|
|||||||
get_dist_domain_size(Id,Sz),
|
get_dist_domain_size(Id,Sz),
|
||||||
get_sizes(Deps, Sizes).
|
get_sizes(Deps, Sizes).
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
:- module(clpbn_display, [
|
:- module(clpbn_display,
|
||||||
clpbn_bind_vals/3]).
|
[clpbn_bind_vals/3]).
|
||||||
|
|
||||||
:- use_module(library(lists),
|
:- use_module(library(lists),
|
||||||
[
|
[member/2]).
|
||||||
member/2
|
|
||||||
]).
|
|
||||||
|
|
||||||
:- use_module(library(clpbn/dists), [get_dist_domain/2]).
|
:- use_module(library(clpbn/dists),
|
||||||
|
[get_dist_domain/2]).
|
||||||
|
|
||||||
:- use_module(library(clpbn), [use_parfactors/1]).
|
:- use_module(library(clpbn),
|
||||||
|
[use_parfactors/1]).
|
||||||
|
|
||||||
:- use_module(library(maplist)).
|
:- use_module(library(maplist)).
|
||||||
|
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
%
|
%
|
||||||
|
|
||||||
:- module(clpbn_dist,
|
:- module(clpbn_dist,
|
||||||
[
|
[dist/1,
|
||||||
dist/1,
|
|
||||||
dist/4,
|
dist/4,
|
||||||
dists/1,
|
dists/1,
|
||||||
dist_new_table/2,
|
dist_new_table/2,
|
||||||
@ -30,7 +29,10 @@
|
|||||||
additive_dists/6
|
additive_dists/6
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(lists),[nth0/3,append/3]).
|
:- use_module(library(lists),
|
||||||
|
[nth0/3,
|
||||||
|
append/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn),
|
:- use_module(library(clpbn),
|
||||||
[use_parfactors/1]).
|
[use_parfactors/1]).
|
||||||
@ -39,11 +41,13 @@
|
|||||||
[matrix_new/4,
|
[matrix_new/4,
|
||||||
matrix_new/3,
|
matrix_new/3,
|
||||||
matrix_to_list/2,
|
matrix_to_list/2,
|
||||||
matrix_to_logs/1]).
|
matrix_to_logs/1
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn/matrix_cpt_utils),
|
:- use_module(library(clpbn/matrix_cpt_utils),
|
||||||
[random_CPT/2,
|
[random_CPT/2,
|
||||||
uniform_CPT/2]).
|
uniform_CPT/2
|
||||||
|
]).
|
||||||
|
|
||||||
/*
|
/*
|
||||||
:- mode dist(+, -).
|
:- mode dist(+, -).
|
||||||
@ -365,3 +369,4 @@ reset_all_dists.
|
|||||||
additive_dists(ip(Domain,Tabs1), ip(Domain,Tabs2), Parents1, Parents2, ip(Domain,Tabs), Parents) :-
|
additive_dists(ip(Domain,Tabs1), ip(Domain,Tabs2), Parents1, Parents2, ip(Domain,Tabs), Parents) :-
|
||||||
append(Tabs1, Tabs2, Tabs),
|
append(Tabs1, Tabs2, Tabs),
|
||||||
append(Parents1, Parents2, Parents).
|
append(Parents1, Parents2, Parents).
|
||||||
|
|
||||||
|
@ -4,26 +4,24 @@
|
|||||||
%
|
%
|
||||||
|
|
||||||
:- module(clpbn_evidence,
|
:- module(clpbn_evidence,
|
||||||
[
|
[store_evidence/1,
|
||||||
store_evidence/1,
|
|
||||||
incorporate_evidence/2,
|
incorporate_evidence/2,
|
||||||
check_stored_evidence/2,
|
check_stored_evidence/2,
|
||||||
add_stored_evidence/2,
|
add_stored_evidence/2,
|
||||||
put_evidence/2
|
put_evidence/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(clpbn), [
|
:- use_module(library(clpbn),
|
||||||
{}/1,
|
[{}/1,
|
||||||
clpbn_flag/3,
|
clpbn_flag/3,
|
||||||
set_clpbn_flag/2
|
set_clpbn_flag/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'), [
|
:- use_module(library('clpbn/dists'),
|
||||||
get_dist/4
|
[get_dist/4]).
|
||||||
]).
|
|
||||||
|
|
||||||
:- use_module(library(rbtrees), [
|
:- use_module(library(rbtrees),
|
||||||
rb_new/1,
|
[rb_new/1,
|
||||||
rb_lookup/3,
|
rb_lookup/3,
|
||||||
rb_insert/4
|
rb_insert/4
|
||||||
]).
|
]).
|
||||||
|
@ -11,48 +11,51 @@
|
|||||||
[gibbs/3,
|
[gibbs/3,
|
||||||
check_if_gibbs_done/1,
|
check_if_gibbs_done/1,
|
||||||
init_gibbs_solver/4,
|
init_gibbs_solver/4,
|
||||||
run_gibbs_solver/3]).
|
run_gibbs_solver/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(rbtrees),
|
:- use_module(library(rbtrees),
|
||||||
[rb_new/1,
|
[rb_new/1,
|
||||||
rb_insert/4,
|
rb_insert/4,
|
||||||
rb_lookup/3]).
|
rb_lookup/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(lists),
|
:- use_module(library(lists),
|
||||||
[member/2,
|
[member/2,
|
||||||
append/3,
|
append/3,
|
||||||
delete/3,
|
delete/3,
|
||||||
max_list/2,
|
max_list/2,
|
||||||
sum_list/2]).
|
sum_list/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(ordsets),
|
:- use_module(library(ordsets),
|
||||||
[ord_subtract/3]).
|
[ord_subtract/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/matrix_cpt_utils'), [
|
:- use_module(library('clpbn/matrix_cpt_utils'),
|
||||||
project_from_CPT/3,
|
[project_from_CPT/3,
|
||||||
reorder_CPT/5,
|
reorder_CPT/5,
|
||||||
multiply_possibly_deterministic_factors/3,
|
multiply_possibly_deterministic_factors/3,
|
||||||
column_from_possibly_deterministic_CPT/3,
|
column_from_possibly_deterministic_CPT/3,
|
||||||
normalise_possibly_deterministic_CPT/2,
|
normalise_possibly_deterministic_CPT/2,
|
||||||
list_from_CPT/2]).
|
list_from_CPT/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/utils'), [
|
:- use_module(library('clpbn/utils'),
|
||||||
check_for_hidden_vars/3]).
|
[check_for_hidden_vars/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'), [
|
:- use_module(library('clpbn/dists'),
|
||||||
get_possibly_deterministic_dist_matrix/5,
|
[get_possibly_deterministic_dist_matrix/5,
|
||||||
get_dist_domain_size/2]).
|
get_dist_domain_size/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/topsort'), [
|
:- use_module(library('clpbn/topsort'),
|
||||||
topsort/2]).
|
[topsort/2]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/display'), [
|
:- use_module(library('clpbn/display'),
|
||||||
clpbn_bind_vals/3]).
|
[clpbn_bind_vals/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/connected'),
|
:- use_module(library('clpbn/connected'),
|
||||||
[
|
[influences/3]).
|
||||||
influences/3
|
|
||||||
]).
|
|
||||||
|
|
||||||
:- dynamic gibbs_params/3.
|
:- dynamic gibbs_params/3.
|
||||||
|
|
||||||
@ -542,5 +545,3 @@ divide_list([C|Add], Sum, [P|Dist]) :-
|
|||||||
P is C/Sum,
|
P is C/Sum,
|
||||||
divide_list(Add, Sum, Dist).
|
divide_list(Add, Sum, Dist).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
% Just output a graph with all the variables.
|
% Just output a graph with all the variables.
|
||||||
%
|
%
|
||||||
|
|
||||||
:- module(clpbn2graph, [clpbn2graph/1]).
|
:- module(clpbn2graph,
|
||||||
|
[clpbn2graph/1]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/utils'), [
|
:- use_module(library('clpbn/utils'),
|
||||||
check_for_hidden_vars/3]).
|
[check_for_hidden_vars/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'), [
|
:- use_module(library('clpbn/dists'),
|
||||||
get_dist/4]).
|
[get_dist/4]).
|
||||||
|
|
||||||
:- attribute node/0.
|
:- attribute node/0.
|
||||||
|
|
||||||
@ -37,7 +38,3 @@ translate_vars([V|Vs],[K|Ks]) :-
|
|||||||
clpbn:get_atts(V, [key(K)]),
|
clpbn:get_atts(V, [key(K)]),
|
||||||
translate_vars(Vs,Ks).
|
translate_vars(Vs,Ks).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
:- module(clpbn_gviz, [clpbn2gviz/4]).
|
|
||||||
|
:- module(clpbn_gviz,
|
||||||
|
[clpbn2gviz/4]).
|
||||||
|
|
||||||
clpbn2gviz(Stream, Name, Network, Output) :-
|
clpbn2gviz(Stream, Name, Network, Output) :-
|
||||||
format(Stream, 'digraph ~w {
|
format(Stream, 'digraph ~w {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
|
:- module(hmm,
|
||||||
:- module(hmm, [init_hmm/0,
|
[init_hmm/0,
|
||||||
hmm_state/1,
|
hmm_state/1,
|
||||||
emission/1]).
|
emission/1
|
||||||
|
]).
|
||||||
|
|
||||||
:- ensure_loaded(library(clpbn)).
|
:- ensure_loaded(library(clpbn)).
|
||||||
|
|
||||||
@ -79,5 +80,3 @@ cvt_vals([A|B],[A|B]).
|
|||||||
find_probs(Logs,Nth,Log) :-
|
find_probs(Logs,Nth,Log) :-
|
||||||
arg(Nth,Logs,Log).
|
arg(Nth,Logs,Log).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
:- module(jt, [jt/3,
|
:- module(jt,
|
||||||
|
[jt/3,
|
||||||
init_jt_solver/4,
|
init_jt_solver/4,
|
||||||
run_jt_solver/3]).
|
run_jt_solver/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(dgraphs),
|
:- use_module(library(dgraphs),
|
||||||
[dgraph_new/1,
|
[dgraph_new/1,
|
||||||
@ -41,14 +42,16 @@
|
|||||||
:- use_module(library(rbtrees),
|
:- use_module(library(rbtrees),
|
||||||
[rb_new/1,
|
[rb_new/1,
|
||||||
rb_insert/4,
|
rb_insert/4,
|
||||||
rb_lookup/3]).
|
rb_lookup/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(ordsets),
|
:- use_module(library(ordsets),
|
||||||
[ord_subset/2,
|
[ord_subset/2,
|
||||||
ord_insert/3,
|
ord_insert/3,
|
||||||
ord_intersection/3,
|
ord_intersection/3,
|
||||||
ord_del_element/3,
|
ord_del_element/3,
|
||||||
ord_memberchk/2]).
|
ord_memberchk/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(lists),
|
:- use_module(library(lists),
|
||||||
[reverse/2]).
|
[reverse/2]).
|
||||||
@ -61,7 +64,8 @@
|
|||||||
:- use_module(library('clpbn/dists'),
|
:- use_module(library('clpbn/dists'),
|
||||||
[get_dist_domain_size/2,
|
[get_dist_domain_size/2,
|
||||||
get_dist_domain/2,
|
get_dist_domain/2,
|
||||||
get_dist_matrix/5]).
|
get_dist_matrix/5
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/matrix_cpt_utils'),
|
:- use_module(library('clpbn/matrix_cpt_utils'),
|
||||||
[project_from_CPT/3,
|
[project_from_CPT/3,
|
||||||
@ -74,14 +78,14 @@
|
|||||||
get_CPT_sizes/2,
|
get_CPT_sizes/2,
|
||||||
reset_CPT_that_disagrees/5,
|
reset_CPT_that_disagrees/5,
|
||||||
sum_out_from_CPT/4,
|
sum_out_from_CPT/4,
|
||||||
list_from_CPT/2]).
|
list_from_CPT/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/display'), [
|
:- use_module(library('clpbn/display'),
|
||||||
clpbn_bind_vals/3]).
|
[clpbn_bind_vals/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/connected'),
|
:- use_module(library('clpbn/connected'),
|
||||||
[
|
[init_influences/3,
|
||||||
init_influences/3,
|
|
||||||
influences/4
|
influences/4
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
random_CPT/2,
|
random_CPT/2,
|
||||||
uniform_CPT/2,
|
uniform_CPT/2,
|
||||||
uniform_CPT_as_list/2,
|
uniform_CPT_as_list/2,
|
||||||
normalise_CPT_on_lines/3]).
|
normalise_CPT_on_lines/3
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(matrix),
|
:- use_module(library(matrix),
|
||||||
[matrix_new/4,
|
[matrix_new/4,
|
||||||
@ -45,7 +46,8 @@
|
|||||||
matrix_agg_lines/3,
|
matrix_agg_lines/3,
|
||||||
matrix_agg_cols/3,
|
matrix_agg_cols/3,
|
||||||
matrix_op_to_lines/4,
|
matrix_op_to_lines/4,
|
||||||
matrix_column/3]).
|
matrix_column/3
|
||||||
|
]).
|
||||||
|
|
||||||
init_CPT(List, Sizes, TAB) :-
|
init_CPT(List, Sizes, TAB) :-
|
||||||
matrix_new(floats, Sizes, List, TAB),
|
matrix_new(floats, Sizes, List, TAB),
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
:- module(clpbn_numbers,
|
:- module(clpbn_numbers,
|
||||||
[
|
[keys_to_numbers/7,
|
||||||
keys_to_numbers/7,
|
|
||||||
keys_to_numbers/9,
|
keys_to_numbers/9,
|
||||||
lists_of_keys_to_ids/6
|
lists_of_keys_to_ids/6
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(library(bhash)).
|
:- use_module(library(bhash)).
|
||||||
:- use_module(library(maplist)).
|
:- use_module(library(maplist)).
|
||||||
|
|
||||||
:- use_module(library(pfl),
|
:- use_module(library(pfl),
|
||||||
[skolem/2,
|
[skolem/2,
|
||||||
get_pfl_cpt/5
|
get_pfl_cpt/5
|
||||||
@ -60,4 +60,3 @@ evidence_to_id(Key=Ev, I0=Ev, Hash0, Hash, I0, I) :-
|
|||||||
b_hash_insert(Hash0, Key, I0, Hash),
|
b_hash_insert(Hash0, Key, I0, Hash),
|
||||||
I is I0+1.
|
I is I0+1.
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,21 +2,20 @@
|
|||||||
|
|
||||||
:- style_check(all).
|
:- style_check(all).
|
||||||
|
|
||||||
:- module(clpbn_pgrammar,[grammar_to_atts/1,
|
:- module(clpbn_pgrammar,
|
||||||
|
[grammar_to_atts/1,
|
||||||
grammar_prob/2,
|
grammar_prob/2,
|
||||||
grammar_mle/2,
|
grammar_mle/2,
|
||||||
init_pcg_solver/4,
|
init_pcg_solver/4,
|
||||||
run_pcg_solver/3,
|
run_pcg_solver/3,
|
||||||
pcg_init_graph/0]).
|
pcg_init_graph/0
|
||||||
|
]).
|
||||||
|
|
||||||
:- load_files([library(clpbn)],
|
:- load_files([library(clpbn)],
|
||||||
[ if(not_loaded),
|
[if(not_loaded), silent(true)]).
|
||||||
silent(true)
|
|
||||||
]).
|
|
||||||
|
|
||||||
:- use_module([library(lists)],
|
:- use_module([library(lists)],
|
||||||
[ sum_list/2
|
[sum_list/2]).
|
||||||
]).
|
|
||||||
|
|
||||||
:- use_module([library(matrix)],
|
:- use_module([library(matrix)],
|
||||||
[matrix_new/3,
|
[matrix_new/3,
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
:- use_module(library(bhash),
|
:- use_module(library(bhash),
|
||||||
[b_hash_new/4,
|
[b_hash_new/4,
|
||||||
b_hash_lookup/3,
|
b_hash_lookup/3,
|
||||||
b_hash_insert/4]).
|
b_hash_insert/4
|
||||||
|
]).
|
||||||
|
|
||||||
:- meta_predicate clpbn_table(:),
|
:- meta_predicate clpbn_table(:),
|
||||||
clpbn_tabled_clause(:.?),
|
clpbn_tabled_clause(:.?),
|
||||||
@ -43,14 +44,13 @@
|
|||||||
clpbn_tabled_number_of_clauses(:,-),
|
clpbn_tabled_number_of_clauses(:,-),
|
||||||
clpbn_is_tabled(:).
|
clpbn_is_tabled(:).
|
||||||
|
|
||||||
:- use_module(library(terms), [
|
:- use_module(library(terms),
|
||||||
instantiated_term_hash/4,
|
[instantiated_term_hash/4,
|
||||||
variant/2
|
variant/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
:- use_module(evidence, [
|
:- use_module(evidence,
|
||||||
put_evidence/2
|
[put_evidence/2]).
|
||||||
]).
|
|
||||||
|
|
||||||
:- dynamic clpbn_table/3.
|
:- dynamic clpbn_table/3.
|
||||||
|
|
||||||
@ -364,4 +364,3 @@ clpbn_is_tabled(M:Clause, _) :- !,
|
|||||||
clpbn_is_tabled(Head, M) :-
|
clpbn_is_tabled(Head, M) :-
|
||||||
clpbn_table(Head, M, _).
|
clpbn_table(Head, M, _).
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
|
|
||||||
:- module(topsort, [topsort/2]).
|
:- module(topsort,
|
||||||
|
[topsort/2]).
|
||||||
|
|
||||||
:- use_module(library(dgraphs),
|
:- use_module(library(dgraphs),
|
||||||
[dgraph_new/1,
|
[dgraph_new/1,
|
||||||
dgraph_add_edges/3,
|
dgraph_add_edges/3,
|
||||||
dgraph_add_vertices/3,
|
dgraph_add_vertices/3,
|
||||||
dgraph_top_sort/2]).
|
dgraph_top_sort/2
|
||||||
|
]).
|
||||||
|
|
||||||
/* simple implementation of a topological sorting algorithm */
|
/* simple implementation of a topological sorting algorithm */
|
||||||
/* graph is as Node-[Parents] */
|
/* graph is as Node-[Parents] */
|
||||||
@ -31,4 +33,3 @@ add_edges([], _V) --> [].
|
|||||||
add_edges([P|Parents], V) --> [P-V],
|
add_edges([P|Parents], V) --> [P-V],
|
||||||
add_edges(Parents, V).
|
add_edges(Parents, V).
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
:- module(clpbn_utils, [
|
|
||||||
clpbn_not_var_member/2,
|
:- module(clpbn_utils,
|
||||||
|
[clpbn_not_var_member/2,
|
||||||
clpbn_var_member/2,
|
clpbn_var_member/2,
|
||||||
check_for_hidden_vars/3,
|
check_for_hidden_vars/3,
|
||||||
sort_vars_by_key/3,
|
sort_vars_by_key/3,
|
||||||
sort_vars_by_key_and_parents/3]).
|
sort_vars_by_key_and_parents/3
|
||||||
|
]).
|
||||||
|
|
||||||
%
|
%
|
||||||
% It may happen that variables from a previous query may still be around.
|
% It may happen that variables from a previous query may still be around.
|
||||||
@ -113,4 +115,3 @@ transform_parents([P|Parents0],[P|NParents],KeyVarsF,KeyVars0) :-
|
|||||||
transform_parents([P|Parents0],[V|NParents],[P-V|KeyVarsF],KeyVars0) :-
|
transform_parents([P|Parents0],[V|NParents],[P-V|KeyVarsF],KeyVars0) :-
|
||||||
transform_parents(Parents0,NParents,KeyVarsF,KeyVars0).
|
transform_parents(Parents0,NParents,KeyVarsF,KeyVars0).
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,41 +14,45 @@
|
|||||||
|
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
:- module(clpbn_ve, [ve/3,
|
:- module(clpbn_ve,
|
||||||
|
[ve/3,
|
||||||
check_if_ve_done/1,
|
check_if_ve_done/1,
|
||||||
init_ve_solver/4,
|
init_ve_solver/4,
|
||||||
run_ve_solver/3,
|
run_ve_solver/3,
|
||||||
init_ve_ground_solver/5,
|
init_ve_ground_solver/5,
|
||||||
run_ve_ground_solver/3,
|
run_ve_ground_solver/3,
|
||||||
call_ve_ground_solver/6]).
|
call_ve_ground_solver/6
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(atts)).
|
:- use_module(library(atts)).
|
||||||
|
|
||||||
:- use_module(library(ordsets),
|
:- use_module(library(ordsets),
|
||||||
[ord_union/3,
|
[ord_union/3,
|
||||||
ord_member/2]).
|
ord_member/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/xbif'), [clpbn2xbif/3]).
|
:- use_module(library('clpbn/xbif'),
|
||||||
|
[clpbn2xbif/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/graphviz'), [clpbn2gviz/4]).
|
:- use_module(library('clpbn/graphviz'),
|
||||||
|
[clpbn2gviz/4]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'),
|
:- use_module(library('clpbn/dists'),
|
||||||
[
|
[dist/4,
|
||||||
dist/4,
|
|
||||||
get_dist_domain_size/2,
|
get_dist_domain_size/2,
|
||||||
get_dist_params/2,
|
get_dist_params/2,
|
||||||
get_dist_domain_size/2,
|
get_dist_domain_size/2,
|
||||||
get_dist_matrix/5]).
|
get_dist_matrix/5
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/utils'), [
|
:- use_module(library('clpbn/utils'),
|
||||||
clpbn_not_var_member/2]).
|
[clpbn_not_var_member/2]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/display'), [
|
:- use_module(library('clpbn/display'),
|
||||||
clpbn_bind_vals/3]).
|
[clpbn_bind_vals/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/connected'),
|
:- use_module(library('clpbn/connected'),
|
||||||
[
|
[init_influences/3,
|
||||||
init_influences/3,
|
|
||||||
influences/4,
|
influences/4,
|
||||||
factor_influences/4
|
factor_influences/4
|
||||||
]).
|
]).
|
||||||
@ -58,8 +62,7 @@
|
|||||||
:- use_module(library(clpbn/numbers)).
|
:- use_module(library(clpbn/numbers)).
|
||||||
|
|
||||||
:- use_module(library(lists),
|
:- use_module(library(lists),
|
||||||
[
|
[member/2,
|
||||||
member/2,
|
|
||||||
append/3,
|
append/3,
|
||||||
delete/3
|
delete/3
|
||||||
]).
|
]).
|
||||||
@ -474,4 +477,3 @@ multiply([F0|Fs], Vs, T) :-
|
|||||||
multiply_factor(f(_,Vs1,T1), f(_,Vs0,T0), f(_,Vs,T)) :-
|
multiply_factor(f(_,Vs1,T1), f(_,Vs0,T0), f(_,Vs,T)) :-
|
||||||
multiply_CPTs(T1, Vs1, T0, Vs0, T, Vs).
|
multiply_CPTs(T1, Vs1, T0, Vs0, T, Vs).
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
|
|
||||||
%:- style_check(all).
|
%:- style_check(all).
|
||||||
|
|
||||||
:- module(viterbi, [viterbi/4]).
|
:- module(viterbi,
|
||||||
|
[viterbi/4]).
|
||||||
|
|
||||||
:- use_module(library(lists),
|
:- use_module(library(lists),
|
||||||
[nth/3,
|
[nth/3,
|
||||||
member/2]).
|
member/2
|
||||||
|
]).
|
||||||
|
|
||||||
:- use_module(library(assoc)).
|
:- use_module(library(assoc)).
|
||||||
|
|
||||||
@ -17,8 +19,8 @@
|
|||||||
|
|
||||||
:- ensure_loaded(library('clpbn/hmm')).
|
:- ensure_loaded(library('clpbn/hmm')).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'), [
|
:- use_module(library('clpbn/dists'),
|
||||||
get_dist_params/2]).
|
[get_dist_params/2]).
|
||||||
|
|
||||||
:- meta_predicate viterbi(:,:,+,-).
|
:- meta_predicate viterbi(:,:,+,-).
|
||||||
|
|
||||||
@ -231,5 +233,3 @@ trace(L1,Next,Dump,Map,Trace0,Trace) :-
|
|||||||
matrix_get(Dump,[NL,P],New),
|
matrix_get(Dump,[NL,P],New),
|
||||||
trace(NL,New,Dump,Map,[Key|Trace0],Trace).
|
trace(NL,New,Dump,Map,[Key|Trace0],Trace).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
:- module(clpbn_vmap,
|
:- module(clpbn_vmap,
|
||||||
[
|
[init_vmap/1, % init_vmap(-Vmap)
|
||||||
init_vmap/1, % init_vmap(-Vmap)
|
|
||||||
add_to_vmap/4, % add_to_vmap(+V,-I,+VMap0,VMapF)
|
add_to_vmap/4, % add_to_vmap(+V,-I,+VMap0,VMapF)
|
||||||
get_from_vmap/3, % add_to_vmap(+V,-I,+VMap0)
|
get_from_vmap/3, % add_to_vmap(+V,-I,+VMap0)
|
||||||
vars_to_numbers/4, % vars_to_numbers(+Vs,-Is,+VMap0,VMapF)
|
vars_to_numbers/4, % vars_to_numbers(+Vs,-Is,+VMap0,VMapF)
|
||||||
@ -39,6 +38,3 @@ lvars_to_numbers(LVs, LIs, VMap0, VMap) :-
|
|||||||
vmap_to_list(vmap(_,Map), L) :-
|
vmap_to_list(vmap(_,Map), L) :-
|
||||||
rb_visit(Map, L).
|
rb_visit(Map, L).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
% XMLBIF support for CLP(BN)
|
% XMLBIF support for CLP(BN)
|
||||||
%
|
%
|
||||||
|
|
||||||
:- module(xbif, [clpbn2xbif/3]).
|
:- module(xbif,
|
||||||
|
[clpbn2xbif/3]).
|
||||||
|
|
||||||
:- use_module(library('clpbn/dists'), [
|
:- use_module(library('clpbn/dists'),
|
||||||
get_dist_domain/2]).
|
[get_dist_domain/2]).
|
||||||
|
|
||||||
clpbn2xbif(Stream, Name, Network) :-
|
clpbn2xbif(Stream, Name, Network) :-
|
||||||
format(Stream, '<?xml version="1.0" encoding="US-ASCII"?>
|
format(Stream, '<?xml version="1.0" encoding="US-ASCII"?>
|
||||||
|
Reference in New Issue
Block a user