added binary flag suppress_attribute_display to clpbn to suppress the dislpaying of attributes
fixed a bug in bnt.yap: the index of the value of the evidence variable start from 1 rather than from 0 added the possibility of computing the marginal of more than one variable in bnt.yap git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2103 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
e748bd9b33
commit
ceaf8af95d
@ -68,13 +68,14 @@
|
||||
sort_vars_by_key/3
|
||||
]).
|
||||
|
||||
:- dynamic solver/1,output/1,use/1.
|
||||
:- dynamic solver/1,output/1,use/1,suppress_attribute_display/1.
|
||||
|
||||
solver(jt).
|
||||
|
||||
%output(xbif(user_error)).
|
||||
%output(gviz(user_error)).
|
||||
output(no).
|
||||
suppress_attribute_display(false).
|
||||
|
||||
clpbn_flag(Flag,Option) :-
|
||||
clpbn_flag(Flag, Option, Option).
|
||||
@ -97,6 +98,10 @@ clpbn_flag(bnt_path,Before,After) :-
|
||||
clpbn_flag(bnt_model,Before,After) :-
|
||||
retract(bnt:bnt_model(Before)),
|
||||
assert(bnt:bnt_model(After)).
|
||||
clpbn_flag(suppress_attribute_display,Before,After) :-
|
||||
retract(suppress_attribute_display(Before)),
|
||||
assert(suppress_attribute_display(After)).
|
||||
|
||||
|
||||
{Var = Key with Dist} :-
|
||||
put_atts(El,[key(Key),dist(DistInfo,Parents)]),
|
||||
@ -135,6 +140,7 @@ clpbn_marginalise(V, Dist) :-
|
||||
% or by call_residue/2
|
||||
%
|
||||
project_attributes(GVars, AVars) :-
|
||||
suppress_attribute_display(false),
|
||||
AVars = [_|_],
|
||||
solver(Solver),
|
||||
( GVars = [_|_] ; Solver = graphs), !,
|
||||
@ -144,6 +150,17 @@ project_attributes(GVars, AVars) :-
|
||||
write_out(Solver,CLPBNGVars, AllVars, DiffVars).
|
||||
project_attributes(_, _).
|
||||
|
||||
call_solver(GVars, AVars) :-
|
||||
AVars = [_|_],
|
||||
solver(Solver),
|
||||
( GVars = [_|_] ; Solver = graphs), !,
|
||||
clpbn_vars(AVars, DiffVars, AllVars),
|
||||
get_clpbn_vars(GVars,CLPBNGVars0),
|
||||
simplify_query_vars(CLPBNGVars0, CLPBNGVars),
|
||||
write_out(Solver,CLPBNGVars, AllVars, DiffVars).
|
||||
|
||||
|
||||
|
||||
clpbn_vars(AVars, DiffVars, AllVars) :-
|
||||
sort_vars_by_key(AVars,SortedAVars,DiffVars),
|
||||
incorporate_evidence(SortedAVars, AllVars).
|
||||
|
@ -107,16 +107,19 @@ create_bnt_graph(AllVars, Representatives, SortedVertices, NumberedVertices, Siz
|
||||
|
||||
|
||||
% make sure MATLAB works.
|
||||
|
||||
init_matlab :-
|
||||
bnt(on), !.
|
||||
init_matlab :-
|
||||
start_matlab,
|
||||
bnt_path(Path),
|
||||
atom_concat('cd ', Path, Command),
|
||||
append("cd ",Path,Command),
|
||||
% atom_concat('cd ', Path, Command),
|
||||
matlab_eval_string(Command),
|
||||
matlab_eval_string('addpath(genpathKPM(pwd))',_),
|
||||
assert(bnt(on)).
|
||||
|
||||
|
||||
start_matlab :-
|
||||
matlab_on, !.
|
||||
start_matlab :-
|
||||
|
@ -15,6 +15,7 @@
|
||||
% what is actually output
|
||||
%
|
||||
attribute_goal(V, G) :-
|
||||
clpbn:suppress_attribute_display(false),
|
||||
get_atts(V, [posterior(Vs,Vals,Ps,AllDiffs)]),
|
||||
massage_out(Vs, Vals, Ps, G, AllDiffs, V).
|
||||
|
||||
|
Reference in New Issue
Block a user