/usr/share/Yap/clpbn/learning/mle.yap is in yap 5.1.3-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | %
% This assumes we have a single big example.
%
:- use_module(library('clpbn_learning/utils'),
[run_all/1,
clpbn_vars/2]).
:- module(bnt_mle, [learn_parameters/2]).
%
% full evidence learning
%
learn_parameters(Items, Tables, Extras) :-
run_all(Items),
attributes:all_attvars(AVars),
% sort and incorporte evidence
clpbn_vars(AVars, AllVars),
mk_sample(AllVars, Sample),
compute_tables(Extras, Sample, Tables).
mk_sample(AllVars, NVars, LL) :-
add2sample(AllVars, Sample),
msort(Sample, AddL),
compute_params(AddL, Parms).
add2sample([], []).
add2sample([V|Vs],[val(Id,[Ev|EParents])|Vals]) :-
clpbn:get_atts(V, [evidence(Ev),dist(Id,Parents)]),
get_eparents(Parents, EParents),
add2sample(Vs, Vals).
get_eparents([P|Parents], [E|EParents]) :-
clpbn:get_atts(V, [evidence(Ev)]),
get_eparents(Parents, EParents).
get_eparents([], []).
compute_tables([], Sample, Tables) :-
mle(Sample, Tables).
compute_tables([laplace|_], Sample, Tables) :-
laplace(Sample, Tables).
|