Learning Rules From User Behaviour
Learning Rules From User Behaviour
Learning Rules From User Behaviour
1 Introduction
2 Background
Inductive Logic Programming (ILP) [4] is concerned with learning logic programs
from examples consisting of factual data that partially describes concepts to
be learned. In our case, examples describe instances of user actions in time.
From examples we aim to derive more general rules that can classify unobserved
examples and therefore predict user actions. More precisely, given a background
theory B that specifies given knowledge and a set of examples E, we attempt
to find a hypothesis H such that B ∪ H |= E (i.e., the examples are logical
consequences of the derived hypotheses together with the background theory).
Formally, a (normal) logic program [7] is a set of clauses of the form:
a0 ← l1 ∧ l2 ∧ ... ∧ ln
where a0 is an atom and each literal li is either an atom ai or a negated atom
¬ai . a0 is the head of the clause and l1 ∧ l2 ∧ ... ∧ ln is its body. The meaning
of a clause is that if all the literals in the body are true, then the head must be
true. An atom p(t1 , ..., tn ) is the application of an n-ary predicate p to n terms
that represent entities in the domain. Any variables (which, by convention, begin
with capital letters) are assumed to be universally quantified over all objects in
the domain. Clauses and literals are ground if they do not contain variables. For
example, the following clause is not ground because it contains the variable T :
do(select mode(silent), T ) ← af ter(T, 09:00) ∧ ¬holdsAt(device is of f, T )
This clause predicts that “the user will select the silent mode at time T, if T
is after 09:00 and the device is not off.” Functions like select mode are conve-
nient because they allow a more immediate representation of data structures,
permitting the encoding of, for example, recursive data types.
The ability to use negative literals in clause bodies gives logic programs a
powerful non-monotonic inference mechanism which is useful for practical appli-
cations, such as ours, that involve reasoning under uncertainty. As in real-life,
non-monotonic reasoning allows previous conclusions (e.g., a bird can fly) to be
retracted on the basis of additional information (e.g., that bird is a penguin).
In what follows, we will show how non-monotonic ILP can also be used to per-
form the general theory revision task of finding a new theory B 0 (which is not
necessarily an extension of the original theory B) to correctly account for newly
acquired examples E. In particular, we show how a nonmonotonic ILP system
called XHAIL (eXtended Hybrid Abductive Inductive Learning) [8] can learn
and revise user theories from examples of their behaviour. XHAIL uses abduc-
tive reasoning to construct a set of initial ground hypotheses that are inductively
generalised afterwards.
The answer to this query will be based on (a) properties of the request such
as the ID of the requester, the time of the request, proofs of identity, etc., (b)
contextual information at the particular time such as the location of the user,
the profile active on the phone or the number of devices nearby and (c) other
application-specific knowledge defined as logical predicates.
To represent dynamic systems, we use the Event Calculus [3]. This temproal
reasoning framework allows us to infer which properties (or fluents) are true at
any given time (denoted holdsAt(F, T )) based on which actions (or events) have
previously occurred (denoted happens(E, T )), along with a knowledge of how
fluents are affected by events.
Conceptually, we consider the hypotheses derived by XHAIL as prescriptions
for changes in the current theory to entail examples, rather than as additional
hypotheses. This permits revising the current theory by adding or deleting entire
rules and/or literals in the body of existing rules.
This result is obtained in three phases, as shown in Figure 1. The inputs to
each step i are: a logic program Bi containing sensory data, available informa-
tion on actions and static concept definitions; the set of current examples Ei
representing user actions; and the current Ui comprising previously learnt rules.
Fig. 1. Revision phases with inputs and outputs at the i-th revision step
Bi is updated when new information is available and the most recent version
is used in the learning step. To cater for drifting concepts [9, 10], examples are
buffered by means of a sliding window, so that only the most recent ones are
used in each learning step. We currently use a simple fixed window size, but we
plan to revisit this issue in future work.
A revision step starts with a pre-processing phase (explained later) that re-
structures Ui into Xi . During the subsequent phase, XHAIL is executed to find
hypotheses Yi . Hypotheses are then used as new rules and to revise existing rules
in a post-processing phase that generates a revised theory U 0 i .
We illustrate this method through a simple scenario where we aim to learn
rules that define the context in which a user accepts incoming calls. This scenario
has been derived from real data on mobile phone usage collected in the course
of the Cityware project [11]. We are showing examples over three days and, for
simplicity, the learning computation is performed at the end of each day consid-
ering only new examples. Figure 2 illustrates the subset of the data provided to
the learning system that appears in rules after the learning is performed.
During the first day (step 0) the user does not answer a call from a contact in
her personal contact list while she is at home at 07:00 (¬do(accept call(c1 1, alice),
07:00)) but subsequent calls are accepted at 07:30 and 11:00. B0 contains, for
example, information about user movements and nearby bluetooth devices to-
gether with properties about the calls like in group(alice, home).
U0 is the initial theory and it is empty thus no pre or post-processing is
needed. XHAIL learns the following rule (see [8] for a description of the learning
algorithm):
0
U 0 = U1 = {
do(accept call(CallId, F rom), T ) ← T ≥ 07:30. } (1)
On the second day the user rejects calls from contacts in her home (H) and
friends (F) groups while at Imperial College, but accepts calls from colleagues
in the college (C) group — which violates the existing rule. A new learning step
Fig. 2. Example scenario (C, H and F denote incoming calls from the user’s college,
home, and friends contact lists respectively. Refused calls are marked with a “ ”)
where try/3 and exception/3 are special predicates (detailed later) introduced
in every revisable clause. Learning exceptions to a rule is equivalent to adding
new conditions to that rule. If the system learns an exception with an empty
body then this is equivalent to deleting the rule.
XHAIL is executed with Bi ∪ Xi as background theory to learn changes
needed to entail examples Ei processed in the current step. The output of the
XHAIL phase for the second day is:
Y1 = {
exception(1, do(accept call(CallId, F rom), T )) ← ¬in group(F rom, college)∧
holdsAt(status(location(imperial)), T ). }
Note that the choice between learning a new rule or revising an existing one,
when both solutions are acceptable, is driven by minimality. Generally, every
revision step minimally changes Ui i.e., every learning step adds/deletes the
minimum number of conditions to/from existing rules, and creates new rules
with the minimum number of literals. This is reasonable since, at each step, we
would like to preserve the knowledge learnt from previous examples.
Day 3 examples trigger a new step to revise rules since two calls from contacts
not included in the College contact list are answered while at Imperial College
and no rules can explain this. Rule (3b) is pre-processed as follows (and rule 3a
is treated analogously):
X2 = { ...
do(accept call(CallId, F rom), T ) ←
try(2, 1, T ≥ 07:30)∧
try(2, 2, ¬holdsAt(status(location(imperial)), T ))∧
¬exception(2, do(accept call(CallId, F rom), T )). } (4)
Following from the definition of try, this means that the examples can be
explained by deleting the literal (2, 1). After theory refactoring in the last phase,
this results in the following rule:
0
U3 = U 2 ={
do(accept call(CallId, F rom), T ) ← T ≥ 07:30 ∧ in group(F rom, college). (5a)
do(accept call(F rom), T ) ← T ≥ 07:30∧
¬holdsAt(status(bluetooth near(desktop computer)), T ). } (5b)
4 Discussion
Our preliminary results suggest that this approach to theory revision based
on the integration of non-monotonic abductive and inductive reasoning can be
exploited to learn rules describing user behaviour.
Although statistical techniques [12] are necessary to process, classify and ag-
gregate raw sensor data upstream, a core logical methodology provides significant
advantages as a subsequent step: descriptive rules constitute executable policies
that users can query, understand, and amend; such policies are modular and ex-
pressed using user-level abstractions; and logic allows principled representations
of space, time and causality.
XHAIL has several advantages compared with other ILP systems. Whilst
Progol5 [13] and Alecto [14], also employ abduction to learn non-observed pred-
icates, they do not have a well-defined semantics for non-monotonic programs
and their handling of negation is limited. Compared to first-order theory revision
systems like INTHELEX [15], Audrey II [16] and FORTE [17], the proposed ex-
tension of XHAIL has a more expressive language, more efficient inconsistency
detection and exploits existing domain specific information to accurately con-
strain possible revisions. Rules like (3b) and (5b) cannot be learnt by FORTE
because it can only learn Horn clauses that do not allow negated literals in the
body. Furthermore the three theory revision systems constrain hypotheses to
function-free clauses and this implies a less compact representation and compli-
cations in the axiomatization and use of Event Calculus.
Acknowledgements
This work is funded by the UK EPSRC (EP/F023294/1) and supported by IBM
Research as part of their Open Collaborative Research (OCR) initiative and
Research Councils UK.
References
1. Ponder2: The ponder2 policy environment. www.ponder2.net
2. Lupu, E., et al.: AMUSe: Autonomic Management of Ubiquitous Systems for e-
health. J. Conc. and Comp.: Practice and Experience 20(3) (2008) 277–295
3. Shanahan, M.: The event calculus explained. LNCS 1600 (1999)
4. Muggleton, S., de Raedt, L.: Inductive logic programming: Theory and methods.
Journal of Logic Programming 19/20 (1994) 629–679
5. Minker, J.: An overview of nonmonotonic reasoning and logic programming. Tech-
nical Report UMIACS-TR-91-112, CS-TR-2736, University of Maryland, College
Park, Maryland 20742 (August 1991)
6. Bandara, A.K., Nuseibeh, B.A., Price, B.A., Rogers, Y., Dulay, N., et al.: Privacy
rights management for mobile applications. In: 4th Int. Symposium on Usable
Privacy and Security, Pittsburgh (July 2008)
7. Lloyd, J.W.: Foundations of Logic Programming, 2nd Edition. Springer (1987)
8. Ray, O.: Nonmonotonic abductive inductive learning. In: Proc. Int. Workshop on
Abduction and Induction in Artificial Intelligence and Bioinformatics. To appear
in Journal of Applied Logic. (2008)
9. Esposito, F., Ferilli, S., Fanizzi, N., Basile, T.M.A., Mauro, N.D.: Incremental
learning and concept drift in inthelex. Intell. Data Anal. 8(3) (2004) 213–237
10. Widmer, G., Kubat, M.: Learning in the presence of concept drift and hidden
contexts. Machine Learning 23(1) (1996) 69–101
11. Cityware: Urban design and pervasive systems. http://www.cityware.org.uk/
12. Eagle, N., Pentland, A.: Reality mining: sensing complex social systems. Personal
and Ubiquitous Computing 10(4) (2006) 255–268
13. Muggleton, S.: Learning from positive data. In: 6th Int. Workshop on Inductive
Logic Programming, London, U.K., Springer Verlag (1996) 358–376
14. Moyle, S.: An investigation into theory completion techniques in inductive logic.
PhD thesis, University of Oxford (2003)
15. Esposito, F., Semeraro, G., Fanizzi, N., Ferilli, S.: Multistrategy theory revision:
Induction and Abduction in INTHELEX. Mach. Learn. 38(1-2) (2000) 133–156
16. Wogulis, J., Pazzani, M.J.: A methodology for evaluating theory revision systems:
Results with Audrey II. In: 13th IJCAI, Chambery (1993) 1128–1134
17. Richards, B.L., Mooney, R.J.: Automated refinement of first-order horn-clause
domain theories. Machine Learning 19(2) (1995) 95–131
18. Ma, J., Russo, A., Broda, K., Clark, K.: DARE: a system for Distributed Abductive
REasoning. J. Autonomous Agents and Multi-Agent Systems 16 (2008) 271–297