ual-logo
Compact representation of conditional probabilityfor rule-based mobile context-aware systems
Szymon Bobek, Grzegorz J. Nalepa
AGH University of Science and Technology
RuleML 20155 August 2015, Berlinhttp://geist.agh.edu.pl
SBK+GJN (AGH-UST) Indect 5 August 2015 1 / 28
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
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
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
ual-logo
Different types of uncertainty
High-level classification1 Uncertainty due to lack of knowledge – that comes from incomplete
information both at the model level or if the information is not provided bythe sensors,
2 Uncertainty due to lack of semantic precision – that may appear due tosemantic mismatch in the notion of the information,
3 Uncertainty due to lack of machine precision – which covers machine sensorsimprecision and ambiguity.
SBK+GJN (AGH-UST) Indect 5 August 2015 6 / 28
ual-logo
Different types of uncertainty
High-level classification1 Uncertainty due to lack of knowledge – that comes from incomplete
information both at the model level or if the information is not provided bythe sensors,
2 Uncertainty due to lack of semantic precision – that may appear due tosemantic mismatch in the notion of the information,
3 Uncertainty due to lack of machine precision – which covers machine sensorsimprecision and ambiguity.
SBK+GJN (AGH-UST) Indect 5 August 2015 6 / 28
ual-logo
Different types of uncertainty
High-level classification1 Uncertainty due to lack of knowledge – that comes from incomplete
information both at the model level or if the information is not provided bythe sensors,
2 Uncertainty due to lack of semantic precision – that may appear due tosemantic mismatch in the notion of the information,
3 Uncertainty due to lack of machine precision – which covers machine sensorsimprecision and ambiguity.
SBK+GJN (AGH-UST) Indect 5 August 2015 6 / 28
ual-logo
Different uncertainty modelling and handlingmechanisms
Uncertainty sourceLack ofknowledge
Semanticimprecision
Machineimprecision
Implementationeffort
Probabilistic w m l HighFuzzy Logic m w w MediumCertainty Factors w m l LowMachine learning l m l High
Table : Comparison of uncertainty handling mechanisms. Full circles represent fullsupport, whereas empty circles represent low or no support.
SBK+GJN (AGH-UST) Indect 5 August 2015 7 / 28
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
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
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
HeaRTDroid
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF approach
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
HeaRTDroid
XTT2 rule representation
SBK+GJN (AGH-UST) Indect 5 August 2015 10 / 28
ual-logo
CF was not enough
Assumed system state
Weather forecast: sunny weather with certainty 0.3, cloudy with 0.1, andrainy 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.1certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 11 / 28
ual-logo
Uncertainties
(?) weather (?) user profile (?) activity cf(conditions) cf(rule) cf(conclusion)0.3 0.6 0.8 0.3 1 0.30.6 0.6 0.8 0.6 1 0.60.6 0.6 0.1 0.1 1 0.10.6 0.84 0.8 0.6 1 0.60.6 0.36 0.8 0.36 1 0.360.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, andrainy 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.1certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 12 / 28
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.1certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 13 / 28
ual-logo
Uncertainties
(?) weather (?) user profile (?) activity cf(conditions) cf(rule) cf(conclusion)0.0 0.6 0.8 0.0 1 0.00.0 0.6 0.8 0.0 1 0.00.0 0.6 0.1 0.0 1 0.00.0 0.84 0.8 0.0 1 0.00.0 0.36 0.8 0.0 1 0.00.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.1certainty and driving with certainty 0.1.
SBK+GJN (AGH-UST) Indect 5 August 2015 14 / 28
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
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 Bayesiannetworks
(?) 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
12345678
123
12
34
56
789
10
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 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 Bayesiannetworks
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 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 Bayesiannetworks
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
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 Bayesiannetworks
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
HeaRTDroid
XTT2 rule representation
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 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 Bayesiannetworks
Intelligibility
Mediation
Uncertainty
Dynamics
Rules
CF
Dynamic CF
HeaRTDroid
Dual representation
SBK+GJN (AGH-UST) Indect 5 August 2015 16 / 28
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
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 inAi 6= di shorthand for Ai ∈
(Di \ {di})neq
Ai 6∈ Vi shorthand for Ai ∈(Di \ Vi )
notin
Table : Formula for simple attributes
Syntax Interpretation Relation
Ai = Vi Ai equal Vi eqAi 6= Vi Ai does not equal
Vineq
Ai ⊆ Vi Ai is a subset Vi subsetAi ⊇ Vi Ai is a superset Vi supsetAi ∼ Vi Ai has non-empty
intersection withVi
sim
Ai 6∼ Vi Ai has empty in-tersection with Vi
notsim
Table : Formula for generalizedattributes
SBK+GJN (AGH-UST) Indect 5 August 2015 18 / 28
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
ual-logo
Probabilistic interpretation of XTT2 models
(?) 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
12345678
123
12
34
56
789
10
SBK+GJN (AGH-UST) Indect 5 August 2015 20 / 28
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
ual-logo
Hybrid reasoning
Data: E – the set of all known attributes valuesA – the set of attributes which values are to be found
Result: V – values for attributes from the set A1 Create a stack of tables T that needs to be processed to obtain V ;2 while not empty T do3 t = pop(T );4 Identify schema (COND,DEC) of table t;5 if ∀c ∈ COND,Val(c) ∈ E then6 Execute table t;7 ∀a ∈ DEC ∩ A : add Val(a) to E and V ;8 else9 Run probabilistic reasoning to obtain P(a)∀a ∈ DEC;
10 Select rule 〈rmax , pmax〉 such that: ∀ 〈r , p〉 ∈ t : p ≤ pmax ;11 if pmax ≥ ε then12 execute rule r ;13 ∀a ∈ DEC ∩ A : add Val(a) to E and V ;14 else15 ∀a ∈ DEC ∩ A : add P(a) to E and V ;16 t = pop(T );17 Identify schema (COND,DEC) of table t;18 goto 919 end20 end21 end22 return V ;
Inference modes1 Deterministic
inference2 Probabilistic
inference3 Hybrid
inference
SBK+GJN (AGH-UST) Indect 5 August 2015 22 / 28
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 andBayesian 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
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