Capítulo 2: Hardware de la silla
2.3 La plataforma Arduino y el joystick
To induce a recursive program, we allow the addition of a literal having the same predicate letter as that in the head of the clause. Various mechanisms must be used to ensure that such a program will terminate one such is to make sure that the new literal has dierent variables than those in the
head literal. The process is best illustrated with another example. Our example continues the one using the airline map, but we make the map somewhat simpler in order to reduce the size of the extensional relations used. Consider the map shown in Fig. 7.4. Again,Band Care hub cities, B1 and B2 are satellites of B, C1 and C2 are satellites of C. We have introduced two new cities,B3andC3. No ights exist between these cities and any other cities|perhaps there are only bus routes as shown by the grey lines in the map.
B C C1 C2 B1 B2 B3 C3
Figure 7.4: Another Airline Route Map
We now seek to learn a program forCanfly(x,y)that covers only those
pairs of cities that can be reached by one or more nonstop ights. The relationCanflyis satised by the following pairs of postive instances: f< B1B >< B1B2>< B1C >< B1C1>< B1C2> < BB1>< B2B1>< CB1>< C1B1>< C2B1> < B2B >< B2C >< B2C1>< B2C2>< BB2> < CB2>< C1B2>< C2B2>< BC >< BC1> < BC2>< CB >< C1B >< C2B >< CC1> < CC2>< C1C >< C2C >< C1C2>< C2C1>g
Using a closed-world assumption on our map, we take the negative instances ofCanflyto be: f< B3B2>< B3B >< B3B1>< B3C >< B3C1> < B3C2>< B3C3>< B2B3>< BB3>< B1B3> < CB3>< C1B3>< C2B3>< C3B3>< C3B2> < C3B >< C3B1>< C3C >< C3C1>< C3C2> < B2C3>< BC3>< B1C3>< CC3>< C1C3> < C2C3>g
We will induceCanfly(x,y)using the extensionally dened background
relationNonstopgiven earlier (modied as required for our reduced airline
map) andCanflyitself (recursively).
As before, we start with the empty program and proceed to the inner loop to construct a clause that is necessary. Suppose that the inner loop adds the background literal Nonstop(x,y). The clause Canfly(x,y) :- Nonstop(x,y) is necessary it covers no negative instances. But it is not
sucient because it does not cover the following positive instances:
f< B1B2>< B1C >< B1C1>< B1C2>< B2B1>
< CB1>< C1B1>< C2B1>< B2C >< B2C1> < B2C2>< CB2>< C1B2>< C2B2>< BC1> < BC2>< C1B >< C2B >< C1C2>< C2C1>g
Thus, we must add anotherclause to the program. In the inner loop, we rst createthe clauseCanfly(x,y) :- Nonstop(x,z)which introducesthe new
variablez. We digress briey to describe how a program containing a clause with unbound variables in its body is interpreted. Suppose we try to inter- pret it for the positive instanceCanfly(B1,B2). The interpreter attempts
to establishNonstop(B1,z)for somez. SinceNonstop(B1, B), for exam-
ple, is a background fact, the interpreter returnsT|which means that the instance< B1B2>is covered. Suppose now, we attempt to interpret the clause for the negative instanceCanfly(B3,B). The interpreter attempts to
establishNonstop(B3,z) for somez. There are no background facts that
match, so the clause does not cover< B3B >. Using the interpreter, we see that the clause Canfly(x,y) :- Nonstop(x,z)covers all of the pos-
itive instances not already covered by the rst clause, but it also covers many negative instances such as< B2B3>, and< BB3>. So the inner
loop must add another literal. This time, suppose it adds Canfly(z,y)
to yield the clause Canfly(x,y) :- Nonstop(x,z), Canfly(z,y). This
clause is necessary no negative instances are covered. The program is now sucient and consistent it is:
Canfly(x,y) :- Nonstop(x,y)
:- Nonstop(x,z), Canfly(z,y)
7.5 Choosing Literals to Add
One of the rst practical ILP systems was Quinlan's FOIL Quinlan, 1990]. A major problem involves deciding how to select a literal to add in the inner loop (from among the literals that are allowed). In FOIL, Quinlan suggested that candidate literals can be compared using an information- like measure|similar to the measures used in inducing decision trees. A measure that gives the same comparison as does Quinlan's is based on the amount by which adding a literal increases theoddsthat an instance drawn at random from those covered by the new clause is a positive instance beyond what these odds were before adding the literal.
Letpbe an estimate of the probability that an instance drawn at ran- dom from those covered by a clause before adding the literal is a posi- tive instance. That is, p =(number of positive instances covered by the clause)/(total number of instances covered by the clause). It is convenient to express this probability in \odds form." The odds,o, that a covered in- stance is positive is dened to beo=p=(1;p). Expressing the probability
in terms of the odds, we obtainp=o=(1 +o).
After selecting a literal, l, to add to a clause, some of the instances previously covered are still covered some of these are positive and some are negative. Letpl denote the probability that an instance drawn at random
from the instances covered by the new clause (with l added) is positive. The odds will be denoted by ol. We want to select a literal, l, that gives
maximal increase in these odds. That is, if we denel=ol=o, we want a
literal that gives a high value ofl. Specializing the clause in such a way
that it fails to cover many of the negative instances previously covered but still covers most of the positive instances previously covered will result in a high value of l. (It turns out that the value of Quinlan's information
theoretic measure increases monotonically withl, so we could just as well
Besides nding a literal with a high value ofl, Quinlan's FOIL system
also restricts the choice to literals that:
a) contain at least one variable that has already been used,
b) place further restrictions on the variables if the literal selected has the same predicate letter as the literal being induced (in order to prevent innite recursion), and
c) survive a pruning test based on the values of l for those literals
selected so far.
We refer the reader to Quinlan's paper for further discussion of these points. Quinlan also discusses post-processing pruning methods and presents ex- perimental results of the method applied to learning recursive relations on lists, on learning rules for chess endgames and for the card game Eleu- sis, and for some other standard tasks mentioned in the machine learning literature.
The reader should also refer to Pazzani & Kibler, 1992, Lavrac & Dzeroski, 1994, Muggleton, 1991, Muggleton, 1992]. Discuss
preprocessing, postprocessing, bottom-up methods, and LINUS.