Did you know ... | Search Documentation: |
Pack pepl -- prolog/pepl.pl |
Pepl is an implemention of the failure adjusted (FAM) algorithm which does parameter estimation (PE) of the probability labels of stochastic logic programs (SLPs).
See documentation fam/1 for details on how to run parameter estimation on SLPs.
Example stochastic programs are in directory slp
and example run scripts are in examples
.
This software is distributed under the MIT licence.
Pepl runs on current versions of SWI (7) and Yap (6.3).
pack_install(pepl). [library(pepl)]. [pack('pepl/examples/main')]. main.
Download latest sources from http://stoics.org.uk/~nicos/sware/pepl or https://github.com/nicos-angelopoulos/pepl
gunzip pepl-*tgz tar xf pepl-*tar cd pepl-* cd examples yap [main]. main.
For SLP source file jc_ml_S1.slp
0.5:: s(X,p) :- p(X), p(X). 0.5:: s(X,q) :- q(X). 0.5:: p(a). 0.5:: p(b). 0.5:: q(a). 0.5:: q(b).
and data file jc_ml_S1_data.pl
frequencies([s(a,p)-4,s(a,q)-3,s(b,p)-2,s(b,q)-3]).
the call succeeds with the learned PPs
?- fam( [goal(s(_A,_B)),slp(jc_ml_S1),datafile('jc_ml_S1_data.pl'),final_pps(PPs)] ). PPs = [0.6602,0.3398,0.5858,0.4142,0.5,0.5]
Options
data.pl
. DataFile
should have either a number of atomic formulae or a single formula
of the form : frequencies(Data)
.rand(S1,S2,S3)
as expected by system
predicate random of the supported prolog systems.bibtex(Type,Key,Pairs)
term of the same publication.
Produces all related publications on backtracking.date(Year,Month,Day)
).
?- pepl_version(V,D). V = 2:2:0, D = date(2021, 1, 1).
file(s)
. .
, and ./slp/
while on SWI it also looks in,
pack(âpepl/slp/â)
.?- sload_pe(coin). ?- set_random(seed(101)). ?- scall(coin(Flip)). Flip = head. ?- scall(coin(Flip)). Flip = tail.
If you have packs: mlu, b_real and Real.
?- lib(mlu). ?- sload_pe(coin). ?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ), mlu_frequency_plot( Freqs, [interface(barplot),outputs([svg]),las=2] ).
Produces file: real_plot.svg
[[doc/html/images/real_plot.svg]]
To demonstrate the inability of SLPs to operate over arbitrary length objects, check:
?- sload_pe(member3). ?- lib(mlu). ?- set_random(seed(101)). ?- mlu_sample( scall(member3(X,[a,b,c])), 100, X, Freqs ), mlu_frequency_plot( Freqs, [interface(barplot),outputs(png),stem('meb3from3'),las=2] ).
Produces file: meb3from3.png
[[doc/html/images/meb3from3.png]]
...and:
?- sload_pe(member3). ?- lib(mlu). ?- set_random(seed(101)). ?- mlu_sample( scall(member3(X,[a,b,c,d,e,f,g,h])), 100, X, Freqs ), mlu_frequency_plot( Freqs, [interface(barplot),outputs(png),stem('meb3from8'),las=2] ).
Produces file: meb3from8.png
[[doc/html/images/meb3from8.png]]
The predicate arguments are as follows.
derivation(s)
.
See predicate main_gen/1, in examples/main_scfg.pl
for example usage.
You can use scall/6 to sample from an SLP.
?- sload_pe(coin). ?- set_random(seed(101)). ?- scall(coin(Flip), 0, sample, Path, Succ, Prb ). Flip = head, Path = [1], Prb = 0.5.
... or to backtrack overall paths
?- scall(coin(Flip), 0, all, Path, Succ, Prb ). Flip = head, Path = [1], Prb = 0.5 ; Flip = tail, Path = [2], Prb = 0.5.
on
or off
.The following predicates are exported, but not or incorrectly documented.