This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/cplint/doc/manual.html
Fabrizio Riguzzi 3659f9036c testing output
2013-09-17 14:10:08 +02:00

1741 lines
89 KiB
HTML
Raw Blame History

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title>cplint Manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- html -->
<meta name="src" content="manual.tex">
<meta name="date" content="2013-09-17 14:09:00">
<link rel="stylesheet" type="text/css" href="manual.css">
</head><body
>
<div class="maketitle">
<h2 class="titleHead">cplint Manual</h2>
<div class="author" ><span
class="cmr-12">Fabrizio Riguzzi</span>
<br /><span
class="cmr-12">fabrizio.riguzzi@unife.it</span></div><br />
<div class="date" ><span
class="cmr-12">September 17, 2013</span></div>
</div>
<h3 class="sectionHead"><span class="titlemark">1 </span> <a
id="x1-10001"></a>Introduction</h3>
<!--l. 31--><p class="noindent" ><span
class="cmtt-10">cplint </span>is a suite of programs for reasoning with ICL <span class="cite">[<a
href="#XDBLP:journals/ai/Poole97">15</a>]</span>, LPADs <span class="cite">[<a
href="#XVenVer03-TR">24</a>,&#x00A0;<a
href="#XVenVer04-ICLP04-IC">25</a>]</span> and
CP-logic programs <span class="cite">[<a
href="#XVenDenBru-JELIA06">22</a>,&#x00A0;<a
href="#XDBLP:journals/tplp/VennekensDB09">23</a>]</span>. It contains programs both for inference and
learning.
<!--l. 33--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">2 </span> <a
id="x1-20002"></a>Installation</h3>
<!--l. 34--><p class="noindent" ><span
class="cmtt-10">cplint </span>is distributed in source code in the source code development tree of Yap. It
includes Prolog and C files. Download it by following the instruction in <a
href="http://www.dcc.fc.up.pt/~vsc/Yap/downloads.html" >
http://www.dcc.fc.up.pt/&#x02DC;vsc/Yap/downloads.html </a>.
<!--l. 36--><p class="indent" > <span
class="cmtt-10">cplint </span>requires <a
href="http://vlsi.colorado.edu/~fabio/CUDD/" > CUDD </a>. You can download CUDD from <a
href="ftp://vlsi.colorado.edu/pub/cudd-2.5.0.tar.gz" >
ftp://vlsi.colorado.edu/pub/cudd-2.5.0.tar.gz </a>.
<!--l. 39--><p class="indent" > Compile CUDD:
<ol class="enumerate1" >
<li
class="enumerate" id="x1-2002x1">decompress cudd-2.4.2.tar.gz
</li>
<li
class="enumerate" id="x1-2004x2"><span
class="cmtt-10">cd cudd-2.4.2</span>
</li>
<li
class="enumerate" id="x1-2006x3">see the <span
class="cmtt-10">README </span>file for instructions on compilation</li></ol>
<!--l. 46--><p class="indent" > Install Yap together with <span
class="cmtt-10">cplint</span>: when compiling Yap following the instruction of
the <span
class="cmtt-10">INSTALL </span>file in the root of the Yap folder, use
<div class="verbatim" id="verbatim-1">
configure&#x00A0;--enable-cplint=DIR
</div>
<!--l. 50--><p class="nopar" > where <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">DIR</span></span></span> is the directory where CUDD is, i.e., the directory ending with
<span
class="cmtt-10">cudd-2.5.0</span>. Under Windows, you have to use Cygwin (CUDD does not compile
under MinGW), so<br
class="newline" />
<div class="verbatim" id="verbatim-2">
configure&#x00A0;--enable-cplint=DIR&#x00A0;--enable-cygwin
</div>
<!--l. 55--><p class="nopar" >
<!--l. 57--><p class="indent" > After having performed <span
class="cmtt-10">make install </span>you can do <span
class="cmtt-10">make installcheck </span>that will
execute a suite of tests of the various programs. If no error is reported you have a
working installation of <span
class="cmtt-10">cplint</span>.
<!--l. 60--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3 </span> <a
id="x1-30003"></a>Syntax</h3>
<!--l. 62--><p class="noindent" >LPAD and CP-logic programs consist of a set of annotated disjunctive clauses.
Disjunction in the head is represented with a semicolon and atoms in the head are
separated from probabilities by a colon. For the rest, the usual syntax of Prolog is
used. For example, the CP-logic clause
<center class="math-display" >
<img
src="manual0x.png" alt="h1 : p1 &#x2228;...&#x2228; hn : pn &#x2190; b1,...,bm,<2C>c1,...,<2C>cl " class="math-display" ></center> is
represented by
<div class="verbatim" id="verbatim-3">
h1:p1&#x00A0;;&#x00A0;...&#x00A0;;&#x00A0;hn:pn&#x00A0;:-&#x00A0;b1,...,bm,\+&#x00A0;c1,....,\+&#x00A0;cl
</div>
<!--l. 69--><p class="nopar" > No parentheses are necessary. The <span
class="cmtt-10">pi </span>are numeric expressions. It is up to the user to
ensure that the numeric expressions are legal, i.e. that they sum up to less than
one.
<!--l. 72--><p class="indent" > If the clause has an empty body, it can be represented like this
<div class="verbatim" id="verbatim-4">
h1:p1&#x00A0;;&#x00A0;...&#x00A0;;hn:pn.
</div>
<!--l. 75--><p class="nopar" > If the clause has a single head with probability 1, the annotation can be omitted and
the clause takes the form of a normal prolog clause, i.e.
<div class="verbatim" id="verbatim-5">
h1:-&#x00A0;b1,...,bm,\+&#x00A0;c1,...,\+&#x00A0;cl.
</div>
<!--l. 79--><p class="nopar" > stands for
<div class="verbatim" id="verbatim-6">
h1:1&#x00A0;:-&#x00A0;b1,...,bm,\+&#x00A0;c1,...,\+&#x00A0;cl.
</div>
<!--l. 83--><p class="nopar" >
<!--l. 85--><p class="indent" > The coin example of <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">25</a>]</span> is represented as (see file <span
class="cmtt-10">coin.cpl</span>)
<div class="verbatim" id="verbatim-7">
heads(Coin):1/2&#x00A0;;&#x00A0;tails(Coin):1/2:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;toss(Coin),\+biased(Coin).
&#x00A0;<br />
&#x00A0;<br />heads(Coin):0.6&#x00A0;;&#x00A0;tails(Coin):0.4:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;toss(Coin),biased(Coin).
&#x00A0;<br />
&#x00A0;<br />fair(Coin):0.9&#x00A0;;&#x00A0;biased(Coin):0.1.
&#x00A0;<br />
&#x00A0;<br />toss(coin).
</div>
<!--l. 96--><p class="nopar" > The first clause states that if we toss a coin that is not biased it has equal
probability of landing heads and tails. The second states that if the coin is biased it
has a slightly higher probability of landing heads. The third states that the coin is
fair with probability 0.9 and biased with probability 0.1 and the last clause states
that we toss a coin with certainty.
<!--l. 99--><p class="indent" > Moreover, the bodies of rules can contain the built-in predicates:
<div class="verbatim" id="verbatim-8">
is/2,&#x00A0;&#x003E;/2,&#x00A0;&#x003C;/2,&#x00A0;&#x003E;=/2&#x00A0;,=&#x003C;/2,
&#x00A0;<br />=:=/2,&#x00A0;=\=/2,&#x00A0;true/0,&#x00A0;false/0,
&#x00A0;<br />=/2,&#x00A0;==/2,&#x00A0;\=/2&#x00A0;,\==/2,&#x00A0;length/2
</div>
<!--l. 104--><p class="nopar" > The bodies can also contain the following library predicates:
<div class="verbatim" id="verbatim-9">
member/2,&#x00A0;max_list/2,&#x00A0;min_list/2
&#x00A0;<br />nth0/3,&#x00A0;nth/3
</div>
<!--l. 110--><p class="nopar" > plus the predicate
<div class="verbatim" id="verbatim-10">
average/2
</div>
<!--l. 114--><p class="nopar" > that, given a list of numbers, computes its arithmetic mean.
<!--l. 117--><p class="indent" > The syntax of ICL program is the one used by the <a
href="http://www.cs.ubc.ca/~poole/aibook/code/ailog/ailog2.html" > AILog 2 </a> system.
<h3 class="sectionHead"><span class="titlemark">4 </span> <a
id="x1-40004"></a>Inference</h3>
<!--l. 119--><p class="noindent" ><span
class="cmtt-10">cplint </span>contains various modules for answering queries.
<!--l. 125--><p class="indent" > These modules answer queries using using goal-oriented procedures:
<ul class="itemize1">
<li class="itemize"><span
class="cmtt-10">lpadsld.pl</span>: uses the top-down procedure described in in <span class="cite">[<a
href="#XRig-AIIA07-IC">16</a>]</span> and <span class="cite">[<a
href="#XRig-RCRA07-IC">17</a>]</span>. It
is based on SLDNF resolution and is an adaptation of the interpreter for
ProbLog <span class="cite">[<a
href="#XDBLP:conf/ijcai/RaedtKT07">11</a>]</span>.
<!--l. 130--><p class="noindent" >It was proved correct <span class="cite">[<a
href="#XRig-RCRA07-IC">17</a>]</span> with respect to the semantics of LPADs for
range restricted acyclic programs <span class="cite">[<a
href="#XDBLP:journals/ngc/AptB91">1</a>]</span> without function symbols.
<!--l. 132--><p class="noindent" >It is also able to deal with extensions of LPADs and CP-logic: the clause
bodies can contain <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof</span>, the probabilities in the head may
be depend on variables in the body and it is possible to specify a uniform
distribution in the head with reference to a <span
class="cmtt-10">setof </span>or <span
class="cmtt-10">bagof </span>operator.
These extended features have been introduced in order to represent
CLP(BN) <span class="cite">[<a
href="#XSanPagQaz03-UAI-IC">21</a>]</span> programs and PRM models <span class="cite">[<a
href="#XGetoor+al:JMLR02">14</a>]</span>: <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof </span>allow to
express dependency of an attribute from an aggregate function of another
attribute, as in CLP(BN) and PRM, while the possibility of specifying a
uniform distribution allows the use of the reference uncertainty feature of
PRM.
</li>
<li class="itemize"><span
class="cmtt-10">picl.pl</span>: performs inference on ICL programs <span class="cite">[<a
href="#XRig09-LJIGPL-IJ">18</a>]</span>
</li>
<li class="itemize"><span
class="cmtt-10">lpad.pl</span>: uses a top-down procedure based on SLG resolution <span class="cite">[<a
href="#XDBLP:journals/jacm/ChenW96">9</a>]</span>. As a
consequence, it works for any sound LPADs, i.e., any LPAD such that
each of its instances has a two valued well founded model.
</li>
<li class="itemize"><span
class="cmtt-10">cpl.pl</span>: uses a top-down procedure based on SLG resolution and moreover
checks that the CP-logic program is valid, i.e., that it has at least an
execution model.
</li>
<li class="itemize">Modules for approximate inference:
<ul class="itemize2">
<li class="itemize"><span
class="cmtt-10">deepit.pl </span>performs iterative deepening <span class="cite">[<a
href="#XBraRig10-ILP10-IC">8</a>]</span>
</li>
<li class="itemize"><span
class="cmtt-10">deepdyn.pl </span>performs dynamic iterative deepening <span class="cite">[<a
href="#XBraRig10-ILP10-IC">8</a>]</span>
</li>
<li class="itemize"><span
class="cmtt-10">bestk.pl </span>performs k-Best <span class="cite">[<a
href="#XBraRig10-ILP10-IC">8</a>]</span>
</li>
<li class="itemize"><span
class="cmtt-10">bestfirst.pl </span>performs best first <span class="cite">[<a
href="#XBraRig10-ILP10-IC">8</a>]</span>
</li>
<li class="itemize"><span
class="cmtt-10">montecarlo.pl </span>performs Monte Carlo <span class="cite">[<a
href="#XBraRig10-ILP10-IC">8</a>]</span>
</li>
<li class="itemize"><span
class="cmtt-10">mcintyre.pl</span>: implements the algorithm MCINTYRE (Monte Carlo
INference wiTh Yap REcord) <span class="cite">[<a
href="#XRig11-CILC11-NC">19</a>]</span></li></ul>
</li>
<li class="itemize"><span
class="cmtt-10">approx/exact.pl </span>as <span
class="cmtt-10">lpadsld.pl </span>but uses SimplecuddLPADs, a modification
of the <a
href="http://dtai.cs.kuleuven.be/problog/download.html" > Simplecudd </a> instead of the <span
class="cmtt-10">cplint </span>library for building BDDs and
computing the probability.</li></ul>
<!--l. 149--><p class="indent" > These modules answer queries using the definition of the semantics of LPADs and
CP-logic:
<ul class="itemize1">
<li class="itemize"><span
class="cmtt-10">semlpadsld.pl</span>: given an LPAD <span
class="cmmi-10">P</span>, it generates all the instances of <span
class="cmmi-10">P</span>.
The probability of a query <span
class="cmmi-10">Q </span>is computed by identifying all the instances
where <span
class="cmmi-10">Q </span>is derivable by SLDNF resolution.
</li>
<li class="itemize"><span
class="cmtt-10">semlpad.pl</span>: given an LPAD <span
class="cmmi-10">P</span>, it generates all the instances of <span
class="cmmi-10">P</span>. The
probability of a query <span
class="cmmi-10">Q </span>is computed by identifying all the instances where
<span
class="cmmi-10">Q </span>is derivable by SLG resolution.
</li>
<li class="itemize"><span
class="cmtt-10">semlcpl.pl</span>: given an LPAD <span
class="cmmi-10">P</span>, it builds an execution model of <span
class="cmmi-10">P</span>, i.e.,
a probabilistic process that satisfy the principles of universal causation,
sufficient causation, independent causation, no deus ex machina events
and temporal precedence. It uses the definition of the semantics given in
<span class="cite">[<a
href="#XDBLP:journals/tplp/VennekensDB09">23</a>]</span>.</li></ul>
<!--l. 159--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.1 </span> <a
id="x1-50004.1"></a>Commands</h4>
<!--l. 161--><p class="noindent" >The LPAD or CP-logic program must be stored in a text file with extension <span
class="cmtt-10">.cpl</span>.
Suppose you have stored the example above in file <span
class="cmtt-10">coin.cpl</span>. In order to answer
queries from this program, you have to run Yap, load one of the modules (such as for
example <span
class="cmtt-10">lpad.pl</span>) by issuing the command
<div class="verbatim" id="verbatim-11">
use_module(library(lpad)).
</div>
<!--l. 166--><p class="nopar" > at the command prompt. Then you must parse the source file <span
class="cmtt-10">coin.cpl </span>with the
command
<div class="verbatim" id="verbatim-12">
p(coin).
</div>
<!--l. 171--><p class="nopar" > if <span
class="cmtt-10">coin.cpl </span>is in the current directory, or
<div class="verbatim" id="verbatim-13">
p(&#8217;path_to_coin/coin&#8217;).
</div>
<!--l. 175--><p class="nopar" > if <span
class="cmtt-10">coin.cpl </span>is in a different directory. At this point you can pose query to the
program by using the predicate <span
class="cmtt-10">s/2 </span>(for solve) that takes as its first argument a
conjunction of goals in the form of a list and returns the computed probability
as its second argument. For example, the probability of the conjunction
<span
class="cmtt-10">head(coin),biased(coin) </span>can be asked with the query
<div class="verbatim" id="verbatim-14">
s([head(coin),biased(coin)],P).
</div>
<!--l. 180--><p class="nopar" > For computing the probability of a conjunction given another conjunction you can
use the predicate <span
class="cmtt-10">sc/3 </span>(for solve conditional) that take takes as input the query
conjunction as its first argument, the evidence conjunction as its second argument
and returns the probability in its third argument. For example, the probability of the
query <span
class="cmtt-10">heads(coin) </span>given the evidence <span
class="cmtt-10">biased(coin) </span>can be asked with the
query
<div class="verbatim" id="verbatim-15">
sc([heads(coin)],[biased(coin)],P).
</div>
<!--l. 185--><p class="nopar" > After having parsed a program, in order to read in a new program you must restart
Yap when using <span
class="cmtt-10">semlpadsld.pl </span>and <span
class="cmtt-10">semlpad.pl</span>. With the other modules, you can
directly parse a new program.
<!--l. 189--><p class="indent" > When using <span
class="cmtt-10">lpad.pl</span>, the system can print the message &#8220;Uunsound program&#8221; in
the case in which an instance with a three valued well founded model is found.
Moreover, it can print the message &#8220;It requires the choice of a head atom from a non
ground head&#8221;: in this case, in order to answer the query, all the groundings of the
culprit clause must be generated, which may be impossible for programs with
function symbols.
<!--l. 191--><p class="indent" > When using <span
class="cmtt-10">semcpl.pl</span>, you can print the execution process by using the
command <span
class="cmtt-10">print. </span>after <span
class="cmtt-10">p(file). </span>Moreover, you can build an execution
process given a context by issuing the command <span
class="cmtt-10">parse(file)</span>. and then
<span
class="cmtt-10">build(context). </span>where <span
class="cmtt-10">context </span>is a list of atoms that are true in the context.
<span
class="cmtt-10">semcpl.pl </span>can print &#8220;Invalid program&#8221; in the case in which no execution process
exists.
<!--l. 196--><p class="indent" > When using <span
class="cmtt-10">cpl.pl </span>you can print a partial execution model including all the
clauses involved in the query issued with <span
class="cmtt-10">print. cpl.pl </span>can print the messages
&#8220;Uunsound program&#8221;, &#8220;It requires the choice of a head atom from a non ground
head&#8221; and &#8220;Invalid program&#8221;.
<!--l. 198--><p class="indent" > For <span
class="cmtt-10">approx/deepit.pl </span>and <span
class="cmtt-10">approx/deepdyn.pl </span>the command
<div class="verbatim" id="verbatim-16">
solve(GoalsList,&#x00A0;ProbLow,&#x00A0;ProbUp,&#x00A0;ResTime,&#x00A0;BddTime)
</div>
<!--l. 201--><p class="nopar" > takes as input a list of goals <span
class="cmtt-10">GoalsList </span>and returns a lower bound on the
probability <span
class="cmtt-10">ProbLow</span>, an upper bound on the probability <span
class="cmtt-10">ProbUp</span>, the CPU time spent
on performing resolution <span
class="cmtt-10">ResTime </span>and the CPU time spent on handling BDDs
<span
class="cmtt-10">BddTime</span>.
<!--l. 204--><p class="indent" > For <span
class="cmtt-10">approx/bestk.pl </span>the command
<div class="verbatim" id="verbatim-17">
solve(GoalsList,&#x00A0;ProbLow,&#x00A0;&#x00A0;ResTime,&#x00A0;BddTime)
</div>
<!--l. 207--><p class="nopar" > takes as input a list of goals <span
class="cmtt-10">GoalsList </span>and returns a lower bound on the
probability <span
class="cmtt-10">ProbLow</span>, the CPU time spent on performing resolution <span
class="cmtt-10">ResTime </span>and the
CPU time spent on handling BDDs <span
class="cmtt-10">BddTime</span>.
<!--l. 210--><p class="indent" > For <span
class="cmtt-10">approx/bestfirst.pl </span>the command
<div class="verbatim" id="verbatim-18">
solve(GoalsList,&#x00A0;ProbLow,&#x00A0;ProbUp,&#x00A0;Count,&#x00A0;ResTime,&#x00A0;BddTime)
</div>
<!--l. 213--><p class="nopar" > takes as input a list of goals <span
class="cmtt-10">GoalsList </span>and returns a lower bound on the
probability <span
class="cmtt-10">ProbLow</span>, an upper bound on the probability <span
class="cmtt-10">ProbUp</span>, the number of
BDDs generated by the algorithm <span
class="cmtt-10">Count</span>, the CPU time spent on performing
resolution <span
class="cmtt-10">ResTime </span>and the CPU time spent on handling BDDs <span
class="cmtt-10">BddTime</span>.
<!--l. 217--><p class="indent" > For <span
class="cmtt-10">approx/montecarlo.pl </span>the command
<div class="verbatim" id="verbatim-19">
solve(GoalsList,&#x00A0;Samples,&#x00A0;Time,&#x00A0;Low,&#x00A0;Prob,&#x00A0;Up)
</div>
<!--l. 221--><p class="nopar" > takes as input a list of goals <span
class="cmtt-10">GoalsList </span>and returns the number of samples taken
<span
class="cmtt-10">Samples</span>, the time required to solve the problem <span
class="cmtt-10">Time</span>, the lower end of the
confidence interval <span
class="cmtt-10">Lower</span>, the estimated probability <span
class="cmtt-10">Prob </span>and the upper end of the
confidence interval <span
class="cmtt-10">Up</span>.
<!--l. 227--><p class="indent" > For <span
class="cmtt-10">mcintyre.pl</span>: the command
<div class="verbatim" id="verbatim-20">
solve(Goals,&#x00A0;Samples,&#x00A0;CPUTime,&#x00A0;WallTime,&#x00A0;Lower,&#x00A0;Prob,&#x00A0;Upper)&#x00A0;:-
</div>
<!--l. 231--><p class="nopar" > takes as input a conjunction of goals <span
class="cmtt-10">Goals </span>and returns the number of samples taken
<span
class="cmtt-10">Samples</span>, the CPU time required to solve the problem <span
class="cmtt-10">CPUTime</span>, the wall time
required to solve the problem <span
class="cmtt-10">CPUTime</span>, the lower end of the confidence interval
<span
class="cmtt-10">Lower</span>, the estimated probability <span
class="cmtt-10">Prob </span>and the upper end of the confidence interval
<span
class="cmtt-10">Up</span>.
<!--l. 236--><p class="indent" > For <span
class="cmtt-10">approx/exact.pl </span>the command
<div class="verbatim" id="verbatim-21">
solve(GoalsList,&#x00A0;Prob,&#x00A0;ResTime,&#x00A0;BddTime)
</div>
<!--l. 240--><p class="nopar" > takes as input a conjunction of goals <span
class="cmtt-10">Goals </span>and returns the probability <span
class="cmtt-10">Prob</span>, the
CPU time spent on performing resolution <span
class="cmtt-10">ResTime </span>and the CPU time spent on
handling BDDs <span
class="cmtt-10">BddTime</span>.
<!--l. 243--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.1.1 </span> <a
id="x1-60004.1.1"></a>Parameters</h5>
<!--l. 244--><p class="noindent" >The modules make use of a number of parameters in order to control their behavior.
They that can be set with the command
<div class="verbatim" id="verbatim-22">
set(parameter,value).
</div>
<!--l. 247--><p class="nopar" > from the Yap prompt after having loaded the module. The current value can be read
with
<div class="verbatim" id="verbatim-23">
setting(parameter,Value).
</div>
<!--l. 252--><p class="nopar" > from the Yap prompt. The available parameters are:
<ul class="itemize1">
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_parsing</span></span></span> (valid for all modules): if (1 - the sum of the
probabilities of all the head atoms) is smaller than <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_parsing</span></span></span> then
<span
class="cmtt-10">cplint </span>adds the null events to the head. Default value 0.00001
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">save_dot</span></span></span> (valid for all goal-oriented modules): if <span
class="cmtt-10">true </span>a graph representing the
BDD is saved in the file <span
class="cmtt-10">cpl.dot </span>in the current directory in dot format. The
variables names are of the form <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">Xn_m</span></span></span> where <span
class="cmtt-10">n </span>is the number of the multivalued
variable and <span
class="cmtt-10">m </span>is the number of the binary variable. The correspondence
between variables and clauses can be evinced from the message printed on the
screen, such as
<div class="verbatim" id="verbatim-24">
Variables:&#x00A0;[(2,[X=2,X1=1]),(2,[X=1,X1=0]),(1,[])]
</div>
<!--l. 266--><p class="nopar" > where the first element of each couple is the clause number of the input file
(starting from 1). In the example above variable <span
class="cmtt-10">X0 </span>corresponds to clause <span
class="cmtt-10">2</span>
with the substitutions <span
class="cmtt-10">X=2,X1=1</span>, variable <span
class="cmtt-10">X1 </span>corresponds to clause <span
class="cmtt-10">2 </span>with the
substitutions <span
class="cmtt-10">X=1,X1=0 </span>and variable <span
class="cmtt-10">X2 </span>corresponds to clause <span
class="cmtt-10">1 </span>with the
empty substitution. You can view the graph with <a
href="http://www.graphviz.org" > <span
class="cmtt-10">graphviz </span></a> using the
command
<div class="verbatim" id="verbatim-25">
dotty&#x00A0;cpl.dot&#x00A0;&amp;
</div>
<!--l. 275--><p class="nopar" >
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ground_body</span></span></span>: (valid for <span
class="cmtt-10">lpadsld.pl </span>and all semantic modules) determines how
non ground clauses are treated: if <span
class="cmtt-10">true</span>, ground clauses are obtained from a non
ground clause by replacing each variable with a constant, if <span
class="cmtt-10">false</span>, ground
clauses are obtained by replacing only variables in the head with a
constant. In the case where the body contains variables not in the
head, setting it to false means that the body represents an existential
event.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">min_error</span></span></span>: (valid for <span
class="cmtt-10">approx/deepit.pl</span>, <span
class="cmtt-10">approx/deepdyn.pl</span>,
<span
class="cmtt-10">approx/bestk.pl</span>, <span
class="cmtt-10">approx/bestfirst.pl</span>, <span
class="cmtt-10">approx/montecarlo.pl </span>and
<span
class="cmtt-10">mcintyre.pl</span>) is the threshold under which the difference between
upper and lower bounds on probability must fall for the algorithm to
stop.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">k</span></span></span>: maximum number of explanations for <span
class="cmtt-10">approx/bestk.pl </span>and
<span
class="cmtt-10">approx/bestfirst.pl </span>and number of samples to take at each iteration for
<span
class="cmtt-10">approx/montecarlo.pl </span>and <span
class="cmtt-10">mcintyre.pl</span>
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">prob_bound</span></span></span>: (valid for <span
class="cmtt-10">approx/deepit.pl</span>, <span
class="cmtt-10">approx/deepdyn.pl</span>,
<span
class="cmtt-10">approx/bestk.pl </span>and <span
class="cmtt-10">approx/bestfirst.pl</span>) is the initial bound on the
probability of explanations when iteratively building explanations
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">prob_step</span></span></span>: (valid for <span
class="cmtt-10">approx/deepit.pl</span>, <span
class="cmtt-10">approx/deepdyn.pl</span>,
<span
class="cmtt-10">approx/bestk.pl </span>and <span
class="cmtt-10">approx/bestfirst.pl</span>) is the increment on the
bound on the probability of explanations when iteratively building
explanations
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">timeout</span></span></span>: (valid for <span
class="cmtt-10">approx/deepit.pl</span>, <span
class="cmtt-10">approx/deepdyn.pl</span>, <span
class="cmtt-10">approx/bestk.pl</span>,
<span
class="cmtt-10">approx/bestfirst.pl </span>and <span
class="cmtt-10">approx/exact.pl</span>) timeout for builduing
BDDs</li></ul>
<!--l. 284--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.2 </span> <a
id="x1-70004.2"></a>Semantic Modules</h4>
<!--l. 285--><p class="noindent" >The three semantic modules need to produce a grounding of the program in order to
compute the semantics. They require an extra file with extension <span
class="cmtt-10">.uni </span>(for universe)
in the same directory where the <span
class="cmtt-10">.cpl </span>file is.
<!--l. 288--><p class="indent" > There are two ways to specify how to ground a program. The first consists in
providing the list of constants to which each variable can be instantiated. For
example, in our case the current directory will contain a file <span
class="cmtt-10">coin.uni </span>that is a
Prolog file containing facts of the form
<div class="verbatim" id="verbatim-26">
universe(var_list,const_list).
</div>
<!--l. 291--><p class="nopar" > where <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">var_list</span></span></span> is a list of variables names (each must be included in single quotes)
and <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">const_list</span></span></span> is a list of constants. The semantic modules generate the grounding
by instantiating in all possible ways the variables of <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">var_list</span></span></span> with the constants of
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">const_list</span></span></span>. Note that the variables are identified by name, so a variable with
the same name in two different clauses will be instantiated with the same
constants.
<!--l. 294--><p class="indent" > The other way to specify how to ground a program consists in using mode and
type information. For each predicate, the file <span
class="cmtt-10">.uni </span>must contain a fact of the
form
<div class="verbatim" id="verbatim-27">
mode(predicate(t1,...,tn)).
</div>
<!--l. 297--><p class="nopar" > that specifies the number and types of each argument of the predicate. Then, the list
of constants that are in the domain of each type <span
class="cmtt-10">ti </span>must be specified with a fact of
the form
<div class="verbatim" id="verbatim-28">
type(ti,list_of_constants).
</div>
<!--l. 302--><p class="nopar" > The file <span
class="cmtt-10">.uni </span>can contain both universe and mode declaration, the ones to be used
depend on the value of the parameter <span
class="cmtt-10">grounding</span>: with value <span
class="cmtt-10">variables</span>, the
universe declarations are used, with value <span
class="cmtt-10">modes </span>the mode declarations are
used.
<!--l. 305--><p class="indent" > With <span
class="cmtt-10">semcpl.pl </span>only mode declarations can be used.
<!--l. 308--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.3 </span> <a
id="x1-80004.3"></a>Extensions</h4>
<!--l. 309--><p class="noindent" >In this section we will present the extensions to the syntax of LPADs and CP-logic
programs that <span
class="cmtt-10">lpadsld </span>can handle.
<!--l. 311--><p class="indent" > When using <span
class="cmtt-10">lpadsld.pl</span>, the bodies can contain the predicates <span
class="cmtt-10">setof/3 </span>and
<span
class="cmtt-10">bagof/3 </span>with the same meaning as in Prolog. Existential quantifiers are allowed in
both, so for example the query
<div class="verbatim" id="verbatim-29">
setof(Z,&#x00A0;(term(X,Y))^foo(X,Y,Z),&#x00A0;L).
</div>
<!--l. 314--><p class="nopar" > returns all the instantiations of <span
class="cmtt-10">Z </span>such that there exists an instantiation of <span
class="cmtt-10">X </span>and <span
class="cmtt-10">Y</span>
for which <span
class="cmtt-10">foo(X,Y,Z) </span>is true.
<!--l. 317--><p class="indent" > An example of the use of <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof </span>is in the file <span
class="cmtt-10">female.cpl</span>:
<div class="verbatim" id="verbatim-30">
male(C):M/P&#x00A0;;&#x00A0;female(C):F/P:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;person(C),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;setof(Male,known_male(Male),LM),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;length(LM,M),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;setof(Female,known_female(Female),LF),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;length(LF,F),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;P&#x00A0;is&#x00A0;F+M.
&#x00A0;<br />
&#x00A0;<br />person(f).
&#x00A0;<br />
&#x00A0;<br />known_female(a).
&#x00A0;<br />known_female(b).
&#x00A0;<br />known_female(c).
&#x00A0;<br />known_male(d).
&#x00A0;<br />known_male(e).
</div>
<!--l. 334--><p class="nopar" > The disjunctive rule expresses the probability of a person of unknown sex of being
male or female depending on the number of males and females that are known. This
is an example of the use of expressions in the probabilities in the head that depend
on variables in the body. The probabilities are well defined because they always sum
to 1 (unless <span
class="cmtt-10">P </span>is 0).
<!--l. 338--><p class="indent" > Another use of <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof </span>is to have an attribute depend on an
aggregate function of another attribute, similarly to what is done in PRM and
CLP(BN).
<!--l. 340--><p class="indent" > So, in the classical school example (available in <span
class="cmtt-10">student.cpl</span>) you can find the
following clauses:
<div class="verbatim" id="verbatim-31">
student_rank(S,h):0.6&#x00A0;;&#x00A0;student_rank(S,l):0.4:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(G,R^(registr_stu(R,S),registr_gr(R,G)),L),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;average(L,Av),Av&#x003E;1.5.
&#x00A0;<br />
&#x00A0;<br />student_rank(S,h):0.4&#x00A0;;&#x00A0;student_rank(S,l):0.6:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(G,R^(registr_stu(R,S),registr_gr(R,G)),L),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;average(L,Av),Av&#x00A0;=&#x003C;&#x00A0;1.5.
</div>
<!--l. 350--><p class="nopar" > where <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">registr_stu(R,S)</span></span></span> expresses that registration <span
class="cmtt-10">R </span>refers to student <span
class="cmtt-10">S </span>and
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">registr_gr(R,G)</span></span></span> expresses that registration <span
class="cmtt-10">R </span>reports grade <span
class="cmtt-10">G </span>which is a natural
number. The two clauses express a dependency of the rank of the student from the
average of her grades.
<!--l. 353--><p class="indent" > Another extension can be used with <span
class="cmtt-10">lpadsld.pl </span>in order to be able to represent
reference uncertainty of PRMs. Reference uncertainty means that the link structure
of a relational model is not fixed but is uncertain: this is represented by having the
instance referenced in a relationship be chosen uniformly from a set. For example,
consider a domain modeling scientific papers: you have a single entity, paper, and a
relationship, cites, between paper and itself that connects the citing paper to the
cited paper. To represent the fact that the cited paper and the citing paper are
selected uniformly from certain sets, the following clauses can be used (see file
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref_simple.cpl</span></span></span>):
<div class="verbatim" id="verbatim-32">
uniform(cites_cited(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(Pap,paper_topic(Pap,theory),L).
&#x00A0;<br />
&#x00A0;<br />uniform(cites_citing(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(Pap,paper_topic(Pap,ai),L).
</div>
<!--l. 360--><p class="nopar" > The first clauses states that the paper <span
class="cmtt-10">P </span>cited in a citation <span
class="cmtt-10">C </span>is selected
uniformly from the set of all papers with topic theory. The second clauses
expresses that the citing paper is selected uniformly from the papers with topic
ai.
<!--l. 365--><p class="indent" > These clauses make use of the predicate
<div class="verbatim" id="verbatim-33">
uniform(Atom,Variable,List)
</div>
<!--l. 368--><p class="nopar" > in the head, where <span
class="cmtt-10">Atom </span>must contain <span
class="cmtt-10">Variable</span>. The meaning is the following:
the set of all the atoms obtained by instantiating <span
class="cmtt-10">Variable </span>of <span
class="cmtt-10">Atom </span>with a
term taken from <span
class="cmtt-10">List </span>is generated and the head is obtained by having a
disjunct for each instantiation with probability 1<span
class="cmmi-10">&#x2215;N </span>where <span
class="cmmi-10">N </span>is the length of
<span
class="cmtt-10">List</span>.
<!--l. 372--><p class="indent" > A more elaborate example is present in file <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref.cpl</span></span></span>:
<div class="verbatim" id="verbatim-34">
uniform(cites_citing(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;setof(Pap,paper(Pap),L).
&#x00A0;<br />
&#x00A0;<br />cites_cited_group(C,theory):0.9&#x00A0;;&#x00A0;cites_cited_group(C,ai):0.1:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;cites_citing(C,P),paper_topic(P,theory).
&#x00A0;<br />
&#x00A0;<br />cites_cited_group(C,theory):0.01;cites_cited_group(C,ai):0.99:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;cites_citing(C,P),paper_topic(P,ai).
&#x00A0;<br />
&#x00A0;<br />uniform(cites_cited(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;cites_cited_group(C,T),bagof(Pap,paper_topic(Pap,T),L).
</div>
<!--l. 385--><p class="nopar" > where the cited paper depends on the topic of the citing paper. In particular, if the
topic is theory, the cited paper is selected uniformly from the papers about theory
with probability 0.9 and from the papers about ai with probability 0.1. if
the topic is ai, the cited paper is selected uniformly from the papers about
theory with probability 0.01 and from the papers about ai with probability
0.99.
<!--l. 388--><p class="indent" > PRMs take into account as well existence uncertainty, where the existence of
instances is also probabilistic. For example, in the paper domain, the total number of
citations may be unknown and a citation between any two paper may have a
probability of existing. For example, a citation between two paper may be more
probable if they are about the same topic:
<div class="verbatim" id="verbatim-35">
cites(X,Y):0.005&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,theory),paper_topic(Y,theory).
&#x00A0;<br />
&#x00A0;<br />cites(X,Y):0.001&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,theory),paper_topic(Y,ai).
&#x00A0;<br />
&#x00A0;<br />cites(X,Y):0.003&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,ai),paper_topic(Y,theory).
&#x00A0;<br />
&#x00A0;<br />cites(X,Y):0.008&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,ai),paper_topic(Y,ai).
</div>
<!--l. 401--><p class="nopar" > This is an example where the probabilities in the head do not sum up to one so the
null event is automatically added to the head. The first clause states that, if the topic
of a paper <span
class="cmtt-10">X </span>is theory and of paper <span
class="cmtt-10">Y </span>is theory, there is a probability of 0.005 that
there is a citation from <span
class="cmtt-10">X </span>to <span
class="cmtt-10">Y</span>. The other clauses consider the remaining cases for the
topics.
<!--l. 406--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.4 </span> <a
id="x1-90004.4"></a>Files</h4>
<!--l. 407--><p class="noindent" >In the directory where Yap keeps the library files (usually <span
class="cmtt-10">/usr/local/share/ Yap</span>)
you can find the directory <span
class="cmtt-10">cplint </span>that contains the files:
<ul class="itemize1">
<li class="itemize"><span
class="cmtt-10">testlpadsld</span><span
class="cmtt-10">_gbtrue.pl, testlpadsld</span><span
class="cmtt-10">_gbfalse.pl, testlpad.pl,</span>
<span
class="cmtt-10">testcpl.pl, testsemlpadsld.pl, testsemlpad.pl testsemcpl.pl</span>:
Prolog programs for testing the modules. They are executed when issuing
the command <span
class="cmtt-10">make installcheck </span>during the installation. To execute
them afterwords, load the file and issue the command <span
class="cmtt-10">t.</span>
</li>
<li class="itemize">Subdirectory <span
class="cmtt-10">examples</span>:
<ul class="itemize2">
<li class="itemize"><span
class="cmtt-10">alarm.cpl</span>: representation of the Bayesian network in Figure 2 of
<span class="cite">[<a
href="#XVenVer04-ICLP04-IC">25</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">coin.cpl</span>: coin example from <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">25</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">coin2.cpl</span>: coin example with two coins.
</li>
<li class="itemize"><span
class="cmtt-10">dice.cpl</span>: dice example from <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">25</a>]</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">twosideddice.cpl,</span><span
class="cmtt-10">&#x00A0;threesideddice.cpl</span></span></span> game with idealized dice
with two or three sides. Used in the experiments in <span class="cite">[<a
href="#XRig-RCRA07-IC">17</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">ex.cpl</span>: first example in <span class="cite">[<a
href="#XRig-RCRA07-IC">17</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">exapprox.cpl</span>: example showing the problems of approximate
inference (see <span class="cite">[<a
href="#XRig-RCRA07-IC">17</a>]</span>).
</li>
<li class="itemize"><span
class="cmtt-10">exrange.cpl</span>: example showing the problems with non range
restricted programs (see <span class="cite">[<a
href="#XRig-RCRA07-IC">17</a>]</span>).
</li>
<li class="itemize"><span
class="cmtt-10">female.cpl</span>: example showing the dependence of probabilities in the
head from variables in the body (from <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">25</a>]</span>).
</li>
<li class="itemize"><span
class="cmtt-10">mendel.cpl, mendels.cpl</span>: programs describing the Mendelian
rules of inheritance, taken from <span class="cite">[<a
href="#XBlo04-ILP04WIP-IC">7</a>]</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref.cpl,</span><span
class="cmtt-10">&#x00A0;paper_ref_simple.cpl</span></span></span>: paper citations examples,
showing reference uncertainty, inspired by <span class="cite">[<a
href="#XGetoor+al:JMLR02">14</a>]</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref_not.cpl</span></span></span>: paper citations example showing that negation
can be used also for predicates defined by clauses with <span
class="cmtt-10">uniform </span>in
the head.
</li>
<li class="itemize"><span
class="cmtt-10">school.cpl</span>: example inspired by the example <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">school_32.yap</span></span></span> from
the source distribution of Yap in the <span
class="cmtt-10">CLPBN </span>directory.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">school_simple.cpl</span></span></span>: simplified version of <span
class="cmtt-10">school.cpl</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">student.cpl</span></span></span>: student example from Figure 1.3 of <span class="cite">[<a
href="#XGetFri01-BC">13</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">win.cpl, light.cpl, trigger.cpl, throws.cpl, hiv.cpl,</span><br
class="newline" /> <span
class="cmtt-10">invalid.cpl</span>: programs taken from <span class="cite">[<a
href="#XDBLP:journals/tplp/VennekensDB09">23</a>]</span>. <span
class="cmtt-10">invalid.cpl </span>is an example
of a program that is invalid but sound.</li></ul>
<!--l. 432--><p class="noindent" >The files <span
class="cmtt-10">*.uni </span>that are present for some of the examples are used by the
semantical modules. Some of the example files contain in an initial comment
some queries together with their result.
</li>
<li class="itemize">Subdirectory <span
class="cmtt-10">doc</span>: contains this manual in latex, html and pdf.</li></ul>
<!--l. 436--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">5 </span> <a
id="x1-100005"></a>Learning</h3>
<!--l. 437--><p class="noindent" ><span
class="cmtt-10">cplint </span>contains the following learning algorithms:
<ul class="itemize1">
<li class="itemize">CEM (<span
class="cmtt-10">cplint </span>EM): an implementation of EM for learning parameters
that is based on <span
class="cmtt-10">lpadsld.pl </span><span class="cite">[<a
href="#XRigDiM11-ML-IJ">20</a>]</span>
</li>
<li class="itemize">RIB (Relational Information Bottleneck): an algorithm for learning
parameters based on the Information Bottleneck <span class="cite">[<a
href="#XRigDiM11-ML-IJ">20</a>]</span>
</li>
<li class="itemize">EMBLEM (EM over Bdds for probabilistic Logic programs Efficient
Mining): an implementation of EM for learning parameters that computes
expectations directly on BDDs <span class="cite">[<a
href="#XBelRig11-IDA">5</a>,&#x00A0;<a
href="#XBelRig11-CILC11-NC">2</a>,&#x00A0;<a
href="#XBelRig11-TR">3</a>]</span>
</li>
<li class="itemize">SLIPCASE (Structure LearnIng of ProbabilistiC logic progrAmS with
Em over bdds): an algorithm for learning the structure of programs by
searching directly the theory space <span class="cite">[<a
href="#XBelRig11-ILP11-IC">4</a>]</span>
</li>
<li class="itemize">SLIPCOVER (Structure LearnIng of Probabilistic logic programs by
searChing OVER the clause space): an algorithm for learning the structure
of programs by searching the clause space and the theory space separatery
<span class="cite">[<a
href="#XBelRig13-TPLP-IJ">6</a>]</span></li></ul>
<!--l. 446--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.1 </span> <a
id="x1-110005.1"></a>Input</h4>
<!--l. 447--><p class="noindent" >To execute the learning algorithms, prepare four files in the same folder:
<ul class="itemize1">
<li class="itemize"><span
class="cmtt-10">&#x003C;stem&#x003E;.kb</span>: contains the example interpretations
</li>
<li class="itemize"><span
class="cmtt-10">&#x003C;stem&#x003E;.bg</span>: contains the background knowledge, i.e., knowledge valid for
all interpretations
</li>
<li class="itemize"><span
class="cmtt-10">&#x003C;stem&#x003E;.l</span>: contains language bias information
</li>
<li class="itemize"><span
class="cmtt-10">&#x003C;stem&#x003E;.cpl</span>: contains the LPAD for you which you want to learn the
parameters or the initial LPAD for SLIPCASE. For SLIPCOVER, this file
should be absent</li></ul>
<!--l. 454--><p class="noindent" >where <span
class="cmtt-10">&#x003C;stem&#x003E; </span>is your dataset name. Examples of these files can be found in the dataset
pages.
<!--l. 456--><p class="indent" > In <span
class="cmtt-10">&#x003C;stem&#x003E;.kb </span>the example interpretations have to be given as a list of Prolog
facts initiated by <span
class="cmtt-10">begin(model(&#x003C;name&#x003E;)). </span>and terminated by <span
class="cmtt-10">end(model(&#x003C;name&#x003E;)).</span>
as in
<div class="verbatim" id="verbatim-36">
begin(model(b1)).
&#x00A0;<br />sameperson(1,2).
&#x00A0;<br />movie(f1,1).
&#x00A0;<br />movie(f1,2).
&#x00A0;<br />workedunder(1,w1).
&#x00A0;<br />workedunder(2,w1).
&#x00A0;<br />gender(1,female).
&#x00A0;<br />gender(2,female).
&#x00A0;<br />actor(1).
&#x00A0;<br />actor(2).
&#x00A0;<br />end(model(b1)).
</div>
<!--l. 470--><p class="nopar" > The interpretations may contain a fact of the form
<div class="verbatim" id="verbatim-37">
prob(0.3).
</div>
<!--l. 474--><p class="nopar" > assigning a probability (0.3 in this case) to the interpretations. If this is omitted, the
probability of each interpretation is considered equal to 1<span
class="cmmi-10">&#x2215;n </span>where <span
class="cmmi-10">n </span>is the total
number of interpretations. <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">prob/1</span></span></span> can be used to set different multiplicity for the
different interpretations.
<!--l. 477--><p class="indent" > In order for RIB to work, the input interpretations must share the Herbrand
universe. If this is not the case, you have to translate the interpretations in this was,
see for example the <span
class="cmtt-10">sp1 </span>files in RIB&#8217;s folder, that are the results of the conversion of
the first fold of the IMDB dataset.
<!--l. 479--><p class="indent" > <span
class="cmtt-10">&#x003C;stem&#x003E;.bg </span>can contain Prolog clauses that can be used to derive additional
conclusions from the atoms in the interpretations.
<!--l. 482--><p class="indent" > <span
class="cmtt-10">&#x003C;stem&#x003E;.l </span>contains the declarations of the input and output predicates, of the
unseen predicates and the commands for setting the algorithms&#8217; parameters. Output
predicates are declared as
<div class="verbatim" id="verbatim-38">
output(&#x003C;predicate&#x003E;/&#x003C;arity&#x003E;).
</div>
<!--l. 486--><p class="nopar" > and define the predicates whose atoms in the input interpretations are used as the
goals for the prediction of which you want to optimize the parameters. Derivations
for these goals are built by the systems.
<!--l. 489--><p class="indent" > Input predicates are those for the predictions of which you do not want to
optimize the parameters. You can declare closed world input predicates
with
<div class="verbatim" id="verbatim-39">
input_cw(&#x003C;predicate&#x003E;/&#x003C;arity&#x003E;).
</div>
<!--l. 492--><p class="nopar" > For these predicates, the only true atoms are those in the interpretations, the
clauses in the input program are not used to derive atoms not present in the
interpretations.
<!--l. 495--><p class="indent" > Open world input predicates are declared with
<div class="verbatim" id="verbatim-40">
input(&#x003C;predicate&#x003E;/&#x003C;arity&#x003E;).
</div>
<!--l. 498--><p class="nopar" > In this case, if a subgoal for such a predicate is encountered when deriving the atoms
for the output predicates, both the facts in the interpretations and the clauses of the
input program are used.
<!--l. 502--><p class="indent" > For RIB, if there are unseen predicates, i.e., predicates that are present in the
input program but not in the interpretations, you have to declare them
with
<div class="verbatim" id="verbatim-41">
unseen(&#x003C;predicate&#x003E;/&#x003C;arity&#x003E;).
</div>
<!--l. 505--><p class="nopar" >
<!--l. 507--><p class="indent" > For SLIPCASE and SLIPCOVER, you have to specify the language bias by
means of mode declarations in the style of <a
href="http://www.doc.ic.ac.uk/~shm/progol.html" > Progol </a>.
<div class="verbatim" id="verbatim-42">
modeh(&#x003C;recall&#x003E;,&#x003C;predicate&#x003E;(&#x003C;arg1&#x003E;,...).
</div>
<!--l. 511--><p class="nopar" > specifies the atoms that can appear in the head of clauses, while
<div class="verbatim" id="verbatim-43">
modeb(&#x003C;recall&#x003E;,&#x003C;predicate&#x003E;(&#x003C;arg1&#x003E;,...).
</div>
<!--l. 515--><p class="nopar" > specifies the atoms that can appear in the body of clauses. <span
class="cmtt-10">&#x003C;recall&#x003E; </span>can be an
integer or <span
class="cmtt-10">* </span>(currently unused).
<!--l. 519--><p class="indent" > The arguments are of the form
<div class="verbatim" id="verbatim-44">
+&#x003C;type&#x003E;
</div>
<!--l. 522--><p class="nopar" > for specifying an input variable of type <span
class="cmtt-10">&#x003C;type&#x003E;</span>, or
<div class="verbatim" id="verbatim-45">
-&#x003C;type&#x003E;
</div>
<!--l. 526--><p class="nopar" > for specifying an output variable of type <span
class="cmtt-10">&#x003C;type&#x003E;</span>. or
<div class="verbatim" id="verbatim-46">
&#x003C;constant&#x003E;
</div>
<!--l. 530--><p class="nopar" > for specifying a constant.
<!--l. 533--><p class="indent" > SLIPCOVER also allows the arguments
<div class="verbatim" id="verbatim-47">
#&#x003C;type&#x003E;
</div>
<!--l. 536--><p class="nopar" > for specifying an argument which should be replaced by a constant of type <span
class="cmtt-10">&#x003C;type&#x003E; </span>in
the bottom clause but should not be used for replacing input variables of the
following literals or
<div class="verbatim" id="verbatim-48">
-#&#x003C;type&#x003E;
</div>
<!--l. 540--><p class="nopar" > for specifying an argument which should be replaced by a constant of type <span
class="cmtt-10">&#x003C;type&#x003E; </span>in
the bottom clause and that should be used for replacing input variables of
the following literals. <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">#</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">-#</span></span></span> differ only in the creation of the bottom
clause.
<!--l. 543--><p class="indent" > An example of language bias for the UWCSE domain is
<div class="verbatim" id="verbatim-49">
output(advisedby/2).
&#x00A0;<br />
&#x00A0;<br />input(student/1).
&#x00A0;<br />input(professor/1).
&#x00A0;<br />....
&#x00A0;<br />
&#x00A0;<br />modeh(*,advisedby(+person,+person)).
&#x00A0;<br />
&#x00A0;<br />modeb(*,professor(+person)).
&#x00A0;<br />modeb(*,student(+person)).
&#x00A0;<br />modeb(*,sameperson(+person,&#x00A0;-person)).
&#x00A0;<br />modeb(*,sameperson(-person,&#x00A0;+person)).
&#x00A0;<br />modeb(*,samecourse(+course,&#x00A0;-course)).
&#x00A0;<br />modeb(*,samecourse(-course,&#x00A0;+course)).
&#x00A0;<br />....
</div>
<!--l. 560--><p class="nopar" > SLIPCOVER also requires facts for the <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">determination/2</span></span></span> predicate that indicate
which predicates can appear in the body of clauses. For example
<div class="verbatim" id="verbatim-50">
determination(professor/1,student/1).
&#x00A0;<br />determination(student/1,hasposition/2).
</div>
<!--l. 566--><p class="nopar" > state that <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">student/1</span></span></span> can appear in the body of clauses for <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">professor/1</span></span></span> and that
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">hasposition/2</span></span></span> can appear in the body of clauses for <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">student/1</span></span></span>.
<!--l. 570--><p class="indent" > SLIPCOVER also allows mode declarations of the form
<div class="verbatim" id="verbatim-51">
modeh(&#x003C;r&#x003E;,[&#x003C;s1&#x003E;,...,&#x003C;sn&#x003E;],[&#x003C;a1&#x003E;,...,&#x003C;an&#x003E;],[&#x003C;P1/Ar1&#x003E;,...,&#x003C;Pk/Ark&#x003E;]).
</div>
<!--l. 573--><p class="nopar" > These mode declarations are used to generate clauses with more than two head
atoms. In them, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;s1&#x003E;,...,&#x003C;sn&#x003E;</span></span></span> are schemas, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;a1&#x003E;,...,&#x003C;an&#x003E;</span></span></span> are atoms such that
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;ai&#x003E;</span></span></span> is obtained from <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;si&#x003E;</span></span></span> by replacing placemarkers with variables, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;Pi/Ari&#x003E;</span></span></span> are
the predicates admitted in the body. <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;a1&#x003E;,...,&#x003C;an&#x003E;</span></span></span> are used to indicate which
variables should be shared by the atoms in the head. An example of such a mode
declaration is
<div class="verbatim" id="verbatim-52">
modeh(*,
&#x00A0;<br />&#x00A0;&#x00A0;[advisedby(+person,+person),tempadvisedby(+person,+person)],
&#x00A0;<br />&#x00A0;&#x00A0;[advisedby(A,B),tempadvisedby(A,B)],
&#x00A0;<br />&#x00A0;&#x00A0;[professor/1,student/1,hasposition/2,inphase/2,
&#x00A0;<br />&#x00A0;&#x00A0;publication/2,taughtby/3,ta/3,courselevel/2,yearsinprogram/2]).
</div>
<!--l. 583--><p class="nopar" >
<!--l. 587--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.2 </span> <a
id="x1-120005.2"></a>Parameters</h4>
<!--l. 588--><p class="noindent" >In order to set the algorithms&#8217; parameters, you have to insert in <span
class="cmtt-10">&#x003C;stem&#x003E;.l </span>commands
of the form
<div class="verbatim" id="verbatim-53">
:-&#x00A0;set(&#x003C;parameter&#x003E;,&#x003C;value&#x003E;).
</div>
<!--l. 591--><p class="nopar" > The available parameters are:
<ul class="itemize1">
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">depth</span></span></span> (values: integer or <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">inf</span></span></span>, default value: 3): depth of derivations if
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">depth_bound</span></span></span> is set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">true</span></span></span>
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">single_var</span></span></span> (values: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">{true,false}</span></span></span>, default value: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">false</span></span></span>, valid for CEM,
EMBLEM, SLIPCASE and SLIPCOVER): if set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">true</span></span></span>, there is a
random variable for each clauses, instead of a separate random variable
for each grounding of a clause
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">sample_size</span></span></span> (values: integer, default value: 1000): total number of
examples in case in which the models in the <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">.kb</span></span></span> file contain a <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">prob(P).</span></span></span>
fact. In that case, one model corresponds to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">sample_size*P</span></span></span> examples
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_em</span></span></span> (values: real, default value: 0.1, valid for CEM, EMBLEM,
SLIPCASE and SLIPCOVER): if the difference in the log likelihood in
two successive EM iteration is smaller than <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_em</span></span></span>, then EM stops
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_em_fraction</span></span></span> (values: real, default value: 0.01, valid for
CEM, EMBLEM, SLIPCASE and SLIPCOVER): if the difference in
the log likelihood in two successive EM iteration is smaller than
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_em_fraction</span></span></span>*(-current log likelihood), then EM stops
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">iter</span></span></span> (values: integer, defualt value: 1, valid for EMBLEM, SLIPCASE and
SLIPCOVER): maximum number of iteration of EM parameter learning.
If set to -1, no maximum number of iterations is imposed
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">iterREF</span></span></span> (values: integer, defualt value: 1, valid for SLIPCASE and
SLIPCOVER): maximum number of iteration of EM parameter learning
for refinements. If set to -1, no maximum number of iterations is imposed.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">random_restarts_number</span></span></span> (values: integer, default value: 1, valid for
CEM, EMBLEM, SLIPCASE and SLIPCOVER): number of random
restarts of EM learning
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">random_restarts_REFnumber</span></span></span> (values: integer, default value: 1, valid for
SLIPCASE and SLIPCOVER): number of random restarts of EM learning
for refinements
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">setrand</span></span></span> (values: rand(integer,integer,integer)): seed for the random
functions, see Yap manual for allowed values
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">minimal_step</span></span></span> (values: [0,1], default value: 0.005, valid for RIB): minimal
increment of <span
class="cmmi-10">&#x03B3;</span>
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">maximal_step</span></span></span> (values: [0,1], default value: 0.1, valid for RIB): maximal
increment of <span
class="cmmi-10">&#x03B3;</span>
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">logsize_fraction</span></span></span> (values: [0,1], default value 0.9, valid for RIB): RIB
stops when <span
class="cmbx-10">I</span>(<span
class="cmmi-10">CH,T</span>;<span
class="cmmi-10">Y </span>) is above <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">logsize_fraction</span></span></span> times its maximum
value (log <span
class="cmsy-10">|</span><span
class="cmmi-10">CH,T</span><span
class="cmsy-10">|</span>, see <span class="cite">[<a
href="#XDBLP:journals/jmlr/ElidanF05">12</a>]</span>)
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">delta</span></span></span> (values: negative integer, default value -10, valid for RIB): value
assigned to log 0
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_fraction</span></span></span> (values: integer, default value 100, valid for RIB):
in the computation of the step, the value of <span
class="cmmi-10">&#x03F5; </span>of <span class="cite">[<a
href="#XDBLP:journals/jmlr/ElidanF05">12</a>]</span> is obtained as
log <span
class="cmsy-10">|</span><span
class="cmmi-10">CH,T</span><span
class="cmsy-10">|&#x00D7;</span><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_fraction</span></span></span>
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">max_rules</span></span></span> (values: integer, default value: 6000, valid for RIB and
SLIPCASE): maximum number of ground rules. Used to set the size of
arrays for storing internal statistics. Can be increased as much as memory
allows.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">logzero</span></span></span> (values: negative real, default value log(0<span
class="cmmi-10">.</span>000001), valid for
SLIPCASE and SLIPCOVER): value assigned to log 0
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">examples</span></span></span> (values: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">atoms</span></span></span>,<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">interpretations</span></span></span>, default value <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">atoms</span></span></span>, valid for
SLIPCASE): determines how BDDs are built: if set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">interpretations</span></span></span>,
a BDD for the conjunction of all the atoms for the target predicates in each
interpretations is built. If set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">atoms</span></span></span>, a BDD is built for the conjunction
of a group of atoms for the target predicates in each interpretations. The
number of atoms in each group is determined by the parameter <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">group</span></span></span>
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">group</span></span></span> (values: integer, default value: 1, valid for SLIPCASE): number of
target atoms in the groups that are used to build BDDs
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">nax_iter</span></span></span> (values: integer, default value: 10, valid for SLIPCASE and
SLIPCOVER): number of interations of beam search
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">max_var</span></span></span> (values: integer, default value: 1, valid for SLIPCASE and
SLIPCOVER): maximum number of distinct variables in a clause
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">verbosity</span></span></span> (values: integer in [1,3], default value: 1): level of verbosity of
the algorithms
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">beamsize</span></span></span> (values: integer, default value: 20, valid for SLIPCASE and
SLIPCOVER): size of the beam
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">megaex_bottom</span></span></span> (values: integer, default value: 1, valid for SLIPCOVER):
number of mega-examples on which to build the bottom clauses
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">initial_clauses_per_megaex</span></span></span> (values: integer, default value: 1, valid for
SLIPCOVER): number of bottom clauses to build for each mega-example
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">d</span></span></span> (values: integer, default value: 10000, valid for SLIPCOVER): number
of saturation steps when building the bottom clause
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">max_iter_structure</span></span></span> (values: integer, default value: 1, valid for
SLIPCOVER): maximum number of theory search iterations
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">background_clauses</span></span></span> (values: integer, default value: 50, valid for
SLIPCOVER): maximum numbers of background clauses
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">maxdepth_var</span></span></span> (values: integer, default value: 2, valid for SLIPCOVER):
maximum depth of variables in clauses (as defined in <span class="cite">[<a
href="#XDBLP:journals/ai/Cohen95">10</a>]</span>).
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">score</span></span></span> (values: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ll</span></span></span>, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">aucpr</span></span></span>, default value <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ll</span></span></span>, valid for SLIPCOVER):
determines the score function for refinement: if set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ll</span></span></span>, log likelihood is
used, if set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">aucpr</span></span></span>, the area under the Precision-Recall curve is used.</li></ul>
<!--l. 635--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.3 </span> <a
id="x1-130005.3"></a>Commands</h4>
<!--l. 636--><p class="noindent" >To execute CEM, load <span
class="cmtt-10">em.pl </span>with
<div class="verbatim" id="verbatim-54">
?:-&#x00A0;use_module(library(&#8217;cplint/em&#8217;)).
</div>
<!--l. 639--><p class="nopar" > and call:
<div class="verbatim" id="verbatim-55">
?:-&#x00A0;em(stem).
</div>
<!--l. 643--><p class="nopar" > To execute RIB, load <span
class="cmtt-10">rib.pl </span>with
<div class="verbatim" id="verbatim-56">
?:-&#x00A0;use_module(library(&#8217;cplint/rib&#8217;)).
</div>
<!--l. 647--><p class="nopar" > and call:
<div class="verbatim" id="verbatim-57">
?:-&#x00A0;ib_par(stem).
</div>
<!--l. 651--><p class="nopar" > To execute EMBLEM, load <span
class="cmtt-10">slipcase.pl </span>with
<div class="verbatim" id="verbatim-58">
?:-&#x00A0;use_module(library(&#8217;cplint/slipcase&#8217;)).
</div>
<!--l. 655--><p class="nopar" > and call
<div class="verbatim" id="verbatim-59">
?:-&#x00A0;em(stem).
</div>
<!--l. 659--><p class="nopar" > To execute SLIPCASE, load <span
class="cmtt-10">slipcase.pl </span>with
<div class="verbatim" id="verbatim-60">
?:-&#x00A0;use_module(library(&#8217;cplint/slipcase&#8217;)).
</div>
<!--l. 663--><p class="nopar" > and call
<div class="verbatim" id="verbatim-61">
?:-&#x00A0;sl(stem).
</div>
<!--l. 667--><p class="nopar" > To execute SLIPCOVER, load <span
class="cmtt-10">slipcover.pl </span>with
<div class="verbatim" id="verbatim-62">
?:-&#x00A0;use_module(library(&#8217;cplint/slipcover&#8217;)).
</div>
<!--l. 671--><p class="nopar" > and call
<div class="verbatim" id="verbatim-63">
?:-&#x00A0;sl(stem).
</div>
<!--l. 675--><p class="nopar" >
<!--l. 678--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.4 </span> <a
id="x1-140005.4"></a>Testing</h4>
<!--l. 679--><p class="noindent" >To test the theories learned, load <span
class="cmtt-10">test.pl </span>with
<div class="verbatim" id="verbatim-64">
?:-&#x00A0;use_module(library(&#8217;cplint/test&#8217;)).
</div>
<!--l. 682--><p class="nopar" > and call
<div class="verbatim" id="verbatim-65">
?:-&#x00A0;main([&#x003C;stem_fold1&#x003E;,...,&#x003C;stem_foldn&#x003E;],[&#x003C;testing_set_fold1&#x003E;,...,
&#x00A0;<br />&#x00A0;&#x00A0;&#x003C;testing_set_foldn&#x003E;]).
</div>
<!--l. 687--><p class="nopar" > For example, if you want to test the theory in <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ai_train.rules</span></span></span> on the set <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ai.kb</span></span></span>,
you can call
<div class="verbatim" id="verbatim-66">
?:-&#x00A0;main([ai_train],[ai]).
</div>
<!--l. 691--><p class="nopar" > The testing program has the following parameter:
<ul class="itemize1">
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">neg_ex</span></span></span> (values: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">given</span></span></span>, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">cw</span></span></span>, default value: <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">cw</span></span></span>): if set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">given</span></span></span>, the negative
examples are taken from <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">&#x003C;testing_set_foldi&#x003E;.kb</span></span></span>, i.e., those example
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">ex</span></span></span> stored as <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">neg(ex)</span></span></span>; if set to <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">cw</span></span></span>, the negative examples are generated
according to the closed world assumption, i.e., all atoms for target
predicates that are not positive examples. The set of all atoms is obtained
by collecting the set of constants for each type of the arguments of the
target predicate.</li></ul>
<!--l. 697--><p class="noindent" >The testing program produces the following output in the current folder:
<ul class="itemize1">
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">cll.pl</span></span></span>: for each fold, the list of examples orderd by their probability of
being true
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">areas.csv</span></span></span>: the areas under the Precision-Recall curve and the Receiver
Operating Characteristic curve
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">curve_roc.m</span></span></span>: a Matlab file for plotting the Receiver Operating
Characteristic curve
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">curve_pr.m</span></span></span>: a Matlab file for plotting the Precision-Recall curve</li></ul>
<!--l. 706--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.5 </span> <a
id="x1-150005.5"></a>Learning Examples</h4>
<!--l. 707--><p class="noindent" >The subfolders <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">em</span></span></span>, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">rib</span></span></span>, <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">slipcase</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">slipcover</span></span></span> of the <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">packages/cplint</span></span></span> folder in
Yap git distribution contain examples of input and output files for the learning
algorithms.
<!--l. 710--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">6 </span> <a
id="x1-160006"></a>License</h3>
<!--l. 715--><p class="noindent" ><span
class="cmtt-10">cplint</span>, as Yap, follows the Artistic License 2.0 that you can find in Yap CVS root
dir. The copyright is by Fabrizio Riguzzi.
<!--l. 718--><p class="indent" > The modules in the approx subdirectory use SimplecuddLPADs, a modification of
the <a
href="http://dtai.cs.kuleuven.be/problog/download.html" > Simplecudd </a> library whose copyright is by Katholieke Universiteit Leuven and
that follows the Artistic License 2.0.
<!--l. 721--><p class="indent" > Some modules use the library <a
href="http://vlsi.colorado.edu/~fabio/" > CUDD </a> for manipulating BDDs that is included in
glu. For the use of CUDD, the following license must be accepted:
<!--l. 726--><p class="indent" > Copyright (c) 1995-2004, Regents of the University of Colorado
<!--l. 728--><p class="indent" > All rights reserved.
<!--l. 730--><p class="indent" > Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
<ul class="itemize1">
<li class="itemize">Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
</li>
<li class="itemize">Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
</li>
<li class="itemize">Neither the name of the University of Colorado nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.</li></ul>
<!--l. 747--><p class="noindent" >THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS <br
class="newline" />AND CONTRIBUTORS &#8221;AS IS&#8221; AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAU-SED <br
class="newline" />AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!--l. 761--><p class="indent" > <span
class="cmtt-10">lpad.pl</span>, <span
class="cmtt-10">semlpad.pl </span>and <span
class="cmtt-10">cpl.pl </span>are based on the SLG system by Weidong
Chen and <a
href="http://www.cs.sunysb.edu/~warren/" > David Scott Warren </a>, Copyright (C) 1993 Southern Methodist University,
1993 SUNY at Stony Brook, see the file COYPRIGHT_SLG for detailed information
on this copyright.
<!--l. 1--><p class="noindent" >
<h3 class="likesectionHead"><a
id="x1-170006"></a>References</h3>
<!--l. 1--><p class="noindent" >
<div class="thebibliography">
<p class="bibitem" ><span class="biblabel">
[1]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/ngc/AptB91"></a>K.&#x00A0;R. Apt and M.&#x00A0;Bezem. Acyclic programs. <span
class="cmti-10">New Gener. Comput.</span>,
9(3/4):335&#8211;364, 1991.
</p>
<p class="bibitem" ><span class="biblabel">
[2]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBelRig11-CILC11-NC"></a>Elena Bellodi and Fabrizio Riguzzi. EM over binary decision diagrams
for probabilistic logic programs. In <span
class="cmti-10">Proceedings of the 26th Italian</span>
<span
class="cmti-10">Conference on Computational Logic (CILC2011), Pescara, Italy, 31 August</span>
<span
class="cmti-10">31-2 September, 2011</span>, 2011.
</p>
<p class="bibitem" ><span class="biblabel">
[3]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBelRig11-TR"></a>Elena Bellodi and Fabrizio Riguzzi. EM over binary decision
diagrams for probabilistic logic programs. Technical Report CS-2011-01,
Dipartimento di Ingegneria, Universit<69> di Ferrara, Italy, 2011.
</p>
<p class="bibitem" ><span class="biblabel">
[4]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBelRig11-ILP11-IC"></a>Elena Bellodi and Fabrizio Riguzzi. Learning the structure of
probabilistic logic programs. In <span
class="cmti-10">Inductive Logic Programming, 21th</span>
<span
class="cmti-10">International Conference, ILP 2011, London, UK, 31 July-3 August, 2011</span>,
2011.
</p>
<p class="bibitem" ><span class="biblabel">
[5]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBelRig11-IDA"></a>Elena Bellodi and Fabrizio Riguzzi. Expectation Maximization over
binary decision diagrams for probabilistic logic programs. <span
class="cmti-10">Intel. Data Anal.</span>,
16(6), 2012.
</p>
<p class="bibitem" ><span class="biblabel">
[6]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBelRig13-TPLP-IJ"></a>Elena Bellodi and Fabrizio Riguzzi. Structure learning of probabilistic
logic programs by searching the clause space. <span
class="cmti-10">Theory and Practice of Logic</span>
<span
class="cmti-10">Programming</span>, 2013.
</p>
<p class="bibitem" ><span class="biblabel">
[7]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBlo04-ILP04WIP-IC"></a>H.&#x00A0;Blockeel. Probabilistic logical models for mendel&#8217;s experiments: An
exercise. In <span
class="cmti-10">Inductive Logic Programming (ILP 2004), Work in Progress</span>
<span
class="cmti-10">Track</span>, 2004.
</p>
<p class="bibitem" ><span class="biblabel">
[8]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBraRig10-ILP10-IC"></a>Stefano Bragaglia and Fabrizio Riguzzi. Approximate inference for logic
programs with annotated disjunctions. In Paolo Frasconi and Francesca
Lisi, editors, <span
class="cmti-10">Inductive Logic Programming 20th International Conference,</span>
<span
class="cmti-10">ILP 2010, Florence, Italy, June 27-30, 2010. Revised Papers</span>, volume 6489
of <span
class="cmti-10">LNCS</span>, pages 30&#8211;37. Springer, 2011.
</p>
<p class="bibitem" ><span class="biblabel">
[9]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/jacm/ChenW96"></a>Weidong Chen and David&#x00A0;Scott Warren. Tabled evaluation with
delaying for general logic programs. <span
class="cmti-10">Journal of the ACM</span>, 43(1):20&#8211;74, 1996.
</p>
<p class="bibitem" ><span class="biblabel">
[10]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/ai/Cohen95"></a>William&#x00A0;W. Cohen. Pac-learning non-recursive prolog clauses. <span
class="cmti-10">Artif.</span>
<span
class="cmti-10">Intell.</span>, 79(1):1&#8211;38, 1995.
</p>
<p class="bibitem" ><span class="biblabel">
[11]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:conf/ijcai/RaedtKT07"></a>L.&#x00A0;De&#x00A0;Raedt, A.&#x00A0;Kimmig, and H.&#x00A0;Toivonen. ProbLog: A probabilistic
Prolog and its application in link discovery. In <span
class="cmti-10">International Joint</span>
<span
class="cmti-10">Conference on Artificial Intelligence</span>, pages 2462&#8211;2467, 2007.
</p>
<p class="bibitem" ><span class="biblabel">
[12]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/jmlr/ElidanF05"></a>G.&#x00A0;Elidan and N.&#x00A0;Friedman. Learning hidden variable networks: The
information bottleneck approach. <span
class="cmti-10">Journal of Machine Learning Research</span>,
6:81&#8211;127, 2005.
</p>
<p class="bibitem" ><span class="biblabel">
[13]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XGetFri01-BC"></a>L.&#x00A0;Getoor, N.&#x00A0;Friedman, D.&#x00A0;Koller, and A.&#x00A0;Pfeffer. Learning
probabilistic relational models. In Saso Dzeroski and Nada Lavrac, editors,
<span
class="cmti-10">Relational Data Mining</span>. Springer-Verlag, Berlin, 2001.
</p>
<p class="bibitem" ><span class="biblabel">
[14]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XGetoor+al:JMLR02"></a>L.&#x00A0;Getoor, N.&#x00A0;Friedman, D.&#x00A0;Koller, and B.&#x00A0;Taskar. Learning
probabilistic models of relational structure. <span
class="cmti-10">Journal of Machine Learning</span>
<span
class="cmti-10">Research</span>, 3:679&#8211;707, December 2002.
</p>
<p class="bibitem" ><span class="biblabel">
[15]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/ai/Poole97"></a>David Poole. The independent choice logic for modelling multiple agents
under uncertainty. <span
class="cmti-10">Artificial Intelligence</span>, 94(1-2):7&#8211;56, 1997.
</p>
<p class="bibitem" ><span class="biblabel">
[16]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRig-AIIA07-IC"></a>Fabrizio Riguzzi. A top down interpreter for LPAD and CP-logic. In
<span
class="cmti-10">Congress of the Italian Association for Artificial Intelligence</span>, volume 4733
of <span
class="cmti-10">LNAI</span>, pages 109&#8211;120. Springer, 2007.
</p>
<p class="bibitem" ><span class="biblabel">
[17]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRig-RCRA07-IC"></a>Fabrizio Riguzzi. A top down interpreter for LPAD and CP-logic.
In <span
class="cmti-10">Proceedings of the 14th RCRA workshop Experimental Evaluation of</span>
<span
class="cmti-10">Algorithms for Solving Problems with Combinatorial Explosion</span>, 2007.
</p>
<p class="bibitem" ><span class="biblabel">
[18]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRig09-LJIGPL-IJ"></a>Fabrizio Riguzzi. Extended semantics and inference for the Independent
Choice Logic. <span
class="cmti-10">Logic Journal of the IGPL</span>, 17(6):589&#8211;629, 2009.
</p>
<p class="bibitem" ><span class="biblabel">
[19]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRig11-CILC11-NC"></a>Fabrizio Riguzzi. MCINTYRE: A Monte Carlo algorithm for
probabilistic logic programming. In <span
class="cmti-10">Proceedings of the 26th Italian</span>
<span
class="cmti-10">Conference on Computational Logic (CILC2011), Pescara, Italy, 31</span>
<span
class="cmti-10">August-2 September, 2011</span>, 2011.
</p>
<p class="bibitem" ><span class="biblabel">
[20]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRigDiM11-ML-IJ"></a>Fabrizio Riguzzi and Nicola&#x00A0;Di Mauro. Applying the information
bottleneck to statistical relational learning. <span
class="cmti-10">Machine Learning</span>, 2011. To
appear.
</p>
<p class="bibitem" ><span class="biblabel">
[21]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XSanPagQaz03-UAI-IC"></a>V.&#x00A0;Santos&#x00A0;Costa, D.&#x00A0;Page, M.&#x00A0;Qazi, and J.&#x00A0;Cussens. CLP(<span
class="cmsy-10"><img
src="cmsy10-42.png" alt="B" class="10x-x-42" /><img
src="cmsy10-4e.png" alt="N" class="10x-x-4e" /></span>):
Constraint logic programming for probabilistic knowledge. In <span
class="cmti-10">Uncertainty</span>
<span
class="cmti-10">in Artificial Intelligence</span>. Morgan Kaufmann, 2003.
</p>
<p class="bibitem" ><span class="biblabel">
[22]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XVenDenBru-JELIA06"></a>J.&#x00A0;Vennekens, M.&#x00A0;Denecker, and M.&#x00A0;Bruynooghe. Representing causal
information about a probabilistic process. In <span
class="cmti-10">Proceedings of the 10th</span>
<span
class="cmti-10">European Conference on Logics in Artificial Intelligence</span>, LNAI. Springer,
September 2006.
</p>
<p class="bibitem" ><span class="biblabel">
[23]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/tplp/VennekensDB09"></a>J.&#x00A0;Vennekens, Marc Denecker, and Maurice Bruynooghe. CP-logic:
A language of causal probabilistic events and its relation to logic
programming. <span
class="cmti-10">Theory Pract. Log. Program.</span>, 9(3):245&#8211;308, 2009.
</p>
<p class="bibitem" ><span class="biblabel">
[24]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XVenVer03-TR"></a>J.&#x00A0;Vennekens and S.&#x00A0;Verbaeten. Logic programs with annotated
disjunctions. Technical Report CW386, K. U. Leuven, 2003.
</p>
<p class="bibitem" ><span class="biblabel">
[25]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XVenVer04-ICLP04-IC"></a>J.&#x00A0;Vennekens, S.&#x00A0;Verbaeten, and M.&#x00A0;Bruynooghe. Logic programs
with annotated disjunctions. In <span
class="cmti-10">International Conference on Logic</span>
<span
class="cmti-10">Programming</span>, volume 3131 of <span
class="cmti-10">LNCS</span>, pages 195&#8211;209. Springer, 2004.
</p>
</div>
</body></html>