small fixes
This commit is contained in:
parent
b2dcc47f9c
commit
e56e1cbacb
@ -35,6 +35,7 @@
|
||||
clpbn_tabled_clause/2,
|
||||
clpbn_tabled_number_of_clauses/2,
|
||||
clpbn_is_tabled/1,
|
||||
clpbn_reset_tables/0,
|
||||
clpbn_tabled_dynamic/1]).
|
||||
|
||||
%
|
||||
@ -90,7 +91,9 @@ store_theory(_,_,_) :-
|
||||
store_theory(_,(H:-_),_) :-
|
||||
clpbn_is_tabled(user:H), !,
|
||||
store_tabled_theory(H).
|
||||
store_theory(_,(H:-_),_) :-
|
||||
store_theory(_,(H:-_),_) :- !,
|
||||
store_theory(H).
|
||||
store_theory(_,H,_) :-
|
||||
store_theory(H).
|
||||
|
||||
store_tabled_theory(H) :-
|
||||
@ -163,6 +166,7 @@ user:cost((H :- B),Inf,Score) :- !,
|
||||
(
|
||||
clpbn_is_tabled(user:H)
|
||||
->
|
||||
clpbn_reset_tables,
|
||||
clpbn_tabled_asserta(user:(H :- IB), R)
|
||||
;
|
||||
asserta(user:(H :- IB), R)
|
||||
@ -251,7 +255,7 @@ key_from_head(H,K,V) :-
|
||||
rewrite_body((A,B), (user:NA,NB), [V|Vs], [D|Ds], Tail) :-
|
||||
rewrite_goal(A, V, D, NA), !,
|
||||
rewrite_body(B, NB, Vs, Ds, Tail).
|
||||
rewrite_body((A,B), (user:A,NB), Vs, Ds, Tail) :-
|
||||
rewrite_body((A,B), (user:A,NB), Vs, Ds, Tail) :- !,
|
||||
rewrite_body(B,NB, Vs, Ds, Tail).
|
||||
rewrite_body(A,(user:NA,Tail), [V], [D], Tail) :-
|
||||
rewrite_goal(A, V, D, NA), !.
|
||||
|
@ -203,6 +203,8 @@ compute_parameters([], [], _, Lik, Lik, _).
|
||||
compute_parameters([Id-Samples|Dists], [Id-NewTable|Tables], MDistTable, Lik0, Lik, LPs:MargVars) :-
|
||||
empty_dist(Id, Table0),
|
||||
add_samples(Samples, Table0, MDistTable),
|
||||
%matrix_to_list(Table0,Mat),
|
||||
%format(user_error, 'FINAL ~d ~w~n', [Id,Mat]),
|
||||
soften_sample(Table0, SoftenedTable),
|
||||
% matrix:matrix_sum(Table0,TotM),
|
||||
normalise_counts(SoftenedTable, NewTable),
|
||||
@ -218,6 +220,7 @@ add_samples([i(_,_,[Case],[])|Samples], Table, MDistTable) :- !,
|
||||
add_samples([i(_,_,Cases,Hiddens)|Samples], Table, MDistTable) :-
|
||||
rb_lookup(Hiddens, Ps, MDistTable),
|
||||
run_sample(Cases, Ps, Table),
|
||||
%matrix_to_list(Table,M), format(user_error, '~w ~w~n', [Cases,Ps]),
|
||||
add_samples(Samples, Table, MDistTable).
|
||||
|
||||
run_sample([], [], _).
|
||||
|
Reference in New Issue
Block a user