Context-aware systems gained huge popularity in recent
years due to rapid evolution of personal mobile devices. Equipped with
variety of sensors, such devices are sources of a lot of valuable information
that allows the system to act in an intelligent way. However, the
certainty and presence of this information may depend on many factors
like measurement accuracy or sensor availability. Such a dynamic
nature of information may cause the system not to work properly or
not to work at all. To allow for robustness of the context-aware system
an uncertainty handling mechanism should be provided with it. Several
approaches were developed to solve uncertainty in context knowledge
bases, including probabilistic reasoning, fuzzy logic, or certainty
factors. In this paper, we present a representation method that combines
strengths of rules based on the attributive logic and Bayesian networks.
Such a combination allows efficiently encode conditional probability distribution
of random variables into a reasoning structure called XTT2.
This provides a method for building hybrid context-aware systems that
allows for robust inference in uncertain knowledge bases.
RuleML2015: Compact representation of conditional probability for rule-based mobile context-aware systems
1. ual-logo
Compact representation of conditional probability
for rule-based mobile context-aware systems
Szymon Bobek, Grzegorz J. Nalepa
AGH University of Science and Technology
RuleML 2015
5 August 2015, Berlin
http://geist.agh.edu.pl
SBK+GJN (AGH-UST) Indect 5 August 2015 1 / 28
2. ual-logo
Outline I
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 2 / 28
3. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 3 / 28
4. ual-logo
Mobile context-aware systems (mCAS)
• Where you are, who you are with, what resources are nearby
(Schillit)
• Any informaiton that can be used to characterize the situation
of an entity (Dey)
• Individuality, activity, location, time, relations (Zimmerman)
• Set of variables that may be of interest for an agent and that
influence its actions (Bolchini)
Context
• Artificial intelligence methods
Aware
• Intelligent homes, intelligent cars, robotics
• Ambient intelligence, pervasive environments, ubiquitous
computing
• Mobile computing (location aware mobile applicaitons)
• Intelligent software (contextual advertising, etc.)
Systems
SBK+GJN (AGH-UST) Indect 5 August 2015 4 / 28
6. ual-logo
Different types of uncertainty
High-level classification
1 Uncertainty due to lack of knowledge – that comes from incomplete
information both at the model level or if the information is not provided by
the sensors,
2 Uncertainty due to lack of semantic precision – that may appear due to
semantic mismatch in the notion of the information,
3 Uncertainty due to lack of machine precision – which covers machine sensors
imprecision and ambiguity.
SBK+GJN (AGH-UST) Indect 5 August 2015 6 / 28
7. ual-logo
Different types of uncertainty
High-level classification
1 Uncertainty due to lack of knowledge – that comes from incomplete
information both at the model level or if the information is not provided by
the sensors,
2 Uncertainty due to lack of semantic precision – that may appear due to
semantic mismatch in the notion of the information,
3 Uncertainty due to lack of machine precision – which covers machine sensors
imprecision and ambiguity.
SBK+GJN (AGH-UST) Indect 5 August 2015 6 / 28
8. ual-logo
Different types of uncertainty
High-level classification
1 Uncertainty due to lack of knowledge – that comes from incomplete
information both at the model level or if the information is not provided by
the sensors,
2 Uncertainty due to lack of semantic precision – that may appear due to
semantic mismatch in the notion of the information,
3 Uncertainty due to lack of machine precision – which covers machine sensors
imprecision and ambiguity.
SBK+GJN (AGH-UST) Indect 5 August 2015 6 / 28
9. ual-logo
Different uncertainty modelling and handling
mechanisms
Uncertainty source
Lack of
knowledge
Semantic
imprecision
Machine
imprecision
Implementation
effort
Probabilistic Q H G High
Fuzzy Logic H Q Q Medium
Certainty Factors Q H G Low
Machine learning G H G High
Table : Comparison of uncertainty handling mechanisms. Full circles represent full
support, whereas empty circles represent low or no support.
SBK+GJN (AGH-UST) Indect 5 August 2015 7 / 28
10. ual-logo
Mobile environment and uncertainty
Nature of mCAS
The uncertainty of data is inevitable and it is dynamic
mCAS are build usually as a user centric systems
Intelligibility is very important as it may improve users trust to the system
Mediation may help resolve ambiguity
SBK+GJN (AGH-UST) Indect 5 August 2015 8 / 28
11. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 9 / 28
19. ual-logo
CF was not enough
Assumed system state
Weather forecast: sunny weather with certainty 0.3, cloudy with 0.1, and
rainy with 0.6.
How much user is interested inn particular POIs: places for eating – 60%,
culture – 20%, entertainment – 80%, sightseeing – 20%.
the user have been recently walking with certainty 0.8, running with 0.1
certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 11 / 28
20. ual-logo
Uncertainties
(?) weather (?) user profile (?) activity cf(conditions) cf(rule) cf(conclusion)
0.3 0.6 0.8 0.3 1 0.3
0.6 0.6 0.8 0.6 1 0.6
0.6 0.6 0.1 0.1 1 0.1
0.6 0.84 0.8 0.6 1 0.6
0.6 0.36 0.8 0.36 1 0.36
0.3 0.36 0.8 0.3 1 0.3
Assumed system state with zero certainty
Weather forecast: sunny weather with certainty 0.3, cloudy with 0.1, and
rainy with 0.6.
How much user is interested inn particular POIs: places for eating – 60%,
culture – 20%, entertainment – 80%, sightseeing – 20%.
the user have been recently walking with certainty 0.8, running with 0.1
certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 12 / 28
21. ual-logo
CF was not enough
Assumed system state
Weather forecast: sunny weather with certainty 0.0, cloudy with 0.0,
and rainy with 0.0.
How much user is interested inn particular POIs: places for eating – 60%,
culture – 20%, entertainment – 80%, sightseeing – 20%.
the user have been recently walking with certainty 0.8, running with 0.1
certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 13 / 28
22. ual-logo
Uncertainties
(?) weather (?) user profile (?) activity cf(conditions) cf(rule) cf(conclusion)
0.0 0.6 0.8 0.0 1 0.0
0.0 0.6 0.8 0.0 1 0.0
0.0 0.6 0.1 0.0 1 0.0
0.0 0.84 0.8 0.0 1 0.0
0.0 0.36 0.8 0.0 1 0.0
0.0 0.36 0.8 0.0 1 0.0
Assumed system state with zero certainty
Weather forecast: sunny weather with certainty 0.0, cloudy with 0.0,
and rainy with 0.0.
How much user is interested inn particular POIs: places for eating – 60%,
culture – 20%, entertainment – 80%, sightseeing – 20%.
the user have been recently walking with certainty 0.8, running with 0.1
certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 14 / 28
23. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 15 / 28
24. ual-logo
Use Bayesian Networks as ”backup” representation
Solution
XTT2 models can be immediately translated into Bayesian networks
HeaRTDroid stores historical states, which can be used to train Bayesian
networks
(?) location (?) daytime (?) today (->) action
= home
= outside
= work
= work
= outside
= home
= home
= home
= outside
= outside
= morning
= morning
= dayatime
= afternoon
= afternoon
= evening
= night
= any
= evening
= night
= workday
= workday
= workday
= workday
= workday
= any
= any
= weekend
= any
= any
:= leaving_home
:= travelling_work
:= working
:= leaving_work
:= travelling_home
:= resting
:= sleeping
:= resting
:= entertaining
:= travelling_home
Table id: tab_4 - Actions
(?) action (?) transportation (->) {application}
= leaving_home
∈ {leaving_work,leaving_home}
∈ {travelling_home,travelling_work}
∈ {travelling_home,travelling_work}
∈ {resting,entertaining}
= working
= sleeping
∈ {resting,entertaining}
= idle
∈ {walking,running}
∈ {driving,cycling}
∈ {bus,train}
∈ {running,cycling}
= any
= idle
∈ {driving,bus,train}
:= {news,weather}
:= {clock,navigation}
:= navigation
:= {news,clock}
:= {sport_tracker,weather}
:= {calendar,mail}
:= clock
:= trip_advisor
Table id: tab_5 - Applications
(?) action (->) profile
∈ {travelling_home,travelling_work,leaving_home,leaving_work}
∈ {working,resting,entertaining}
= sleeping
:= loud
:= vibrations
:= offline
Table id: tab_6 - Profile
1
2
3
4
5
6
7
8
1
2
3
1
2
3
4
5
6
7
8
9
10
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 28
25. ual-logo
Use Bayesian Networks as ”backup” representation
Solution
XTT2 models can be immediately translated into Bayesian networks
HeaRTDroid stores historical states, which can be used to train Bayesian
networks
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 28
26. ual-logo
Use Bayesian Networks as ”backup” representation
Solution
XTT2 models can be immediately translated into Bayesian networks
HeaRTDroid stores historical states, which can be used to train Bayesian
networks
XTT2 Model Manager
Reasoning Engine
Working Memory
-n
-n+1
-1
0
.
.
.
Contex Providers
HeaRTDroid
States
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 28
27. ual-logo
Use Bayesian Networks as ”backup” representation
Solution
XTT2 models can be immediately translated into Bayesian networks
HeaRTDroid stores historical states, which can be used to train Bayesian
networks
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
HeaRTDroid
XTT2 rule representation
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 28
28. ual-logo
Use Bayesian Networks as ”backup” representation
Solution
XTT2 models can be immediately translated into Bayesian networks
HeaRTDroid stores historical states, which can be used to train Bayesian
networks
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
HeaRTDroid
Dual representation
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 28
29. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 17 / 28
30. ual-logo
ALSV(FD) logic
XTT2 rule in ALSV(FD) logic
(Ai ∝ di ) ∧ (Aj ∝ dj ) ∧ . . . (Am ∝ Vm) ∧ (An ∝ Vn) −→ RHS
Syntax Interpretation Relation
Ai = di value of Ai is pre-
cisely defined as di
eq
Ai ∈ Vi value of Ai is in Vi in
Ai = di shorthand for Ai ∈
(Di {di })
neq
Ai ∈ Vi shorthand for Ai ∈
(Di Vi )
notin
Table : Formula for simple attributes
Syntax Interpretation Relation
Ai = Vi Ai equal Vi eq
Ai = Vi Ai does not equal
Vi
neq
Ai ⊆ Vi Ai is a subset Vi subset
Ai ⊇ Vi Ai is a superset Vi supset
Ai ∼ Vi Ai has non-empty
intersection with
Vi
sim
Ai ∼ Vi Ai has empty in-
tersection with Vi
notsim
Table : Formula for generalized
attributes
SBK+GJN (AGH-UST) Indect 5 August 2015 18 / 28
31. ual-logo
Probabilistic interpretation of ALSV(FD) rule
XTT2 rule as conditional probability
(Ai ∝ di ) ∧ (Aj ∝ dj ) ∧ . . . (An ∝ dn) −→ (Ad = dd )
(Ai ∝ di ) ∧ (Aj ∝ dj ) ∧ . . . (An ∝ dn) −→ Ag = {v1, v2, . . . vn}
P(DEC | COND)
Interpretation
Every rule is represented by a pair r, p , where r is an XTT2 rule and p ∈ [0; 1]
defines a certainty of a rule given its preconditions.
simple attributes p : P (Ad | Ai , Aj . . . , An)
generalised attributes
P(Ag = {v1, v2, . . . vn} | Ai , Aj , . . . , An) = P(v1 | Ai , Aj , . . . , An)·
P(v2 | Ai , Aj , . . . , An)·
. . .
P(vn | Ai , Aj , . . . , An)
SBK+GJN (AGH-UST) Indect 5 August 2015 19 / 28
34. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 21 / 28
35. ual-logo
Hybrid reasoning
Data: E – the set of all known attributes values
A – the set of attributes which values are to be found
Result: V – values for attributes from the set A
1 Create a stack of tables T that needs to be processed to obtain V ;
2 while not empty T do
3 t = pop(T);
4 Identify schema (COND, DEC) of table t;
5 if ∀c ∈ COND, Val(c) ∈ E then
6 Execute table t;
7 ∀a ∈ DEC ∩ A : add Val(a) to E and V ;
8 else
9 Run probabilistic reasoning to obtain P(a)∀a ∈ DEC;
10 Select rule rmax , pmax such that: ∀ r, p ∈ t : p ≤ pmax ;
11 if pmax ≥ then
12 execute rule r;
13 ∀a ∈ DEC ∩ A : add Val(a) to E and V ;
14 else
15 ∀a ∈ DEC ∩ A : add P(a) to E and V ;
16 t = pop(T);
17 Identify schema (COND, DEC) of table t;
18 goto 9
19 end
20 end
21 end
22 return V ;
Inference modes
1 Deterministic
inference
2 Probabilistic
inference
3 Hybrid
inference
SBK+GJN (AGH-UST) Indect 5 August 2015 22 / 28
36. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
37. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
38. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
39. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
40. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
41. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
42. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
(->) B
1
2
3
4
5
No. (?) A
B = a
B = b
B = c
B = d
B = e
P(B=d | evidence) = 0.2
P(B=c | evidence) = 0.2
P(B=b | evidence) = 0.2
P(B=a | evidence) = 0.2
P(B=e | evidence) = 0.2
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
43. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
44. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
(->) E(?) B
1
2
3
4
5
No. (?) D
E = a
E = b
E = c
E = d
E = e
P(E=d | evidence) = 0.6
P(E=c | evidence) = 0.1
P(E=b | evidence) = 0.0
P(E=a | evidence) = 0.1
P(E=e | evidence) = 0.2
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
45. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
46. ual-logo
Hybrid reasoning
Assumptions
Value of attribute G is needed
Only value of attribute C is known
Attribute F is set to be in/out
A B
C D
B D E
E F
E G
SBK+GJN (AGH-UST) Indect 5 August 2015 23 / 28
47. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 24 / 28
48. ual-logo
Prototype Implementation
Components
HeaRTDroid for deterministic reasoning and training set preparation
Translator XTT2 to BN
WEKA
Prototype reasoner that combines HeaRTDroid and WEKA
HeaRTDroidWeka
XTT2 Model
Translator
XTT2 to BN
Hybrid Reasoner
States
SBK+GJN (AGH-UST) Indect 5 August 2015 25 / 28
49. ual-logo
Outline
1 Introduction
2 Previous works
3 Proposed solution
4 Probabilistic interpretation of XTT2 rules
5 Probabilistic reasoning in XTT2 models
6 Implementation
7 Summary and future work
SBK+GJN (AGH-UST) Indect 5 August 2015 26 / 28
50. ual-logo
Summary and future work
Summary
We provided probabilistic interpretation of XTT2 knowledge representation
We proposed a hybrid inference algorithm
We implemented prototype reasoner that binds HeaRTDroid, XTT2 and
Bayesian network representation of XTT2 into one hybrid reasoner
Future works
Make the reasoner part of HeaRTDroid
Evaluate the hybrid reasoning on the real-life use case
SBK+GJN (AGH-UST) Indect 5 August 2015 27 / 28
51. ual-logo
Thank you for your attention!
Do you have any questions?
RuleML 2015
http://geist.agh.edu.pl
SBK+GJN (AGH-UST) Indect 5 August 2015 28 / 28