Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
A Smart Home Testbed for Evaluating XAI with Non-Experts
1. A Smart Home Testbed for Evaluating
XAI with Non-Experts
Kevin McAreavey, Kim Bauters, and Weiru Liu
2. Introduction
Background
• Research project helping users protect against AI threats in AI-enabled domestic life (e.g. smart homes):
1. Identify theoretically and experimentally the AI-borne attack surface in domestic life
2. Isolate the psychological, social, neurological and digital literacy factors of users that influence individual susceptibility to AI risks
3. Evaluate the different approaches of AI explainability in terms of their influence on an individual’s AI cyber risk perception
4. Formulate and solve the optimisation problem of the allocation of cyber hygiene measures against their benefits and costs
5. Develop a personalised cyber hygiene training programme for users to protect themselves
• In-the-wild research study
• Develop AI-enabled smart home application testbed (“CHApp”)
• Deploy in 20 homes within social housing sector in England (i.e. non-expert lay users)
Cyber Hygiene in AI-enabled Domestic Life
3. Introduction
Some Challenges
• Challenge 1: Not just about ML
• Need for XAI across many AI subfields (e.g. robotics,
planning, multi-agent systems)
• Need to reflect AI systems that stakeholders typically
encounter (e.g. hybrid AI systems in smart homes)
• Challenge 2: Not just for AI experts/developers
• Current XAI research tends to emphasise expert
stakeholders (e.g. system developers, data scientists)
• Explanations that are useful to experts are not necessarily
useful to non-experts
• Challenge 3: Evaluation
• Evaluating XAI requires a core AI system (“a primary task”)
• Time-consuming to implement/deploy, especially in the
context of non-expert stakeholders
Figure 1: Barredo Arrieta et al. (2020)
?
XAI
AI
AI
Planning
Robotics
NLP
Speech
Computer vision
MAS
DL
RL
KRR
…
…
ML
4. Introduction
A Testbed to Support Research Studies Evaluating XAI with Non-Experts…
Application 1: Electricity Application 2: Heating
Reference application(s) Powervault GridFLEX Nest Learning Thermostat, Ecobee eco+, etc.
Sensor(s) Smart plug(s) or smart meter Temperature sensor(s)
Actuator(s) Smart home battery Smart TRV(s)
AI components a. AI planning for battery scheduling
b. ML for electricity price forecasting
c. ML for electricity consumption forecasting
a. AI planning for TRV/thermostat scheduling
b. ML to for user setpoint schedule learning
5. Application 1
Background
• Dynamic electricity tariffs (e.g. Octopus, Engie)
• Wholesale prices auctioned each day and vary in 30-minute blocks
• With traditional (e.g. fixed-rate) tariffs, supplier bears risk/reward
• Smart meters allow this risk/reward to be passed to consumers
• Exporting (sell) surplus electricity to the grid
• Import price (e.g. y < 35 p/kWh), export price (e.g. y > 0 p/kWh)
• Smart home batteries
• Integrates with home electricity supply
• Large capacity (e.g. 8 kWh – power home in UK for 24 hours)
• Expensive (e.g. £8k for 8 kWh Powervault 3)
• Benefits the grid / energy supplier (i.e. consumer incentives)
• Useful for in-home charging of electric vehicles
6. Application 1a
Battery Scheduling (1)
prices. Import prices have
h and permit negative pric-
s may receive payment for
ve import price events oc-
tly exceeds demand and it
on the grid. Export prices
Wh, meaning that in some
ve no payment for supply-
er be charged for doing so.
rovide high-capacity stor-
tricity. Examples include
nd the Tesla Powerwall.
amic tariffs these batteries
ce customer costs if they
e low and discharged when
gy suppliers they help to
which is of particular con-
redictable renewable sup-
of the Powervault 3 range
UK at £8k, so in order to
cost savings of £15.38 per
nty. This suggests that cur-
above manner may not be
e situation may change in
battery technology, or due
ther tasks such as at-home
es. Electricity prices have
n 2021 due to both supply
he cost of EU Allowances
able machine learning needed to explain predictions.
3.1.1 Scheduling Battery Control
We start by formalising the high-level AI planning
problem as follows:
Definition 1. A battery scheduling problem is a tuple
(b,s1,l,tmax,U,PI,PE) where:
• b 2 R 0 is the (battery) capacity constant
• s1 2 [0,b] is the current (battery) level
• l 2 [0,b] is the (dis)charge rate per timestep
• tmax 2 N is the horizon with D = {1,2,...,tmax}
• U : D ! R the (electricity) consumption forecast
• PI : D ! R the (electricity) import price forecast
• PE : D ! R the (electricity) export price forecast
Definition 1 assumes that all parameters are spec-
ified on the same unit scale (e.g. kWh). The function
U then encodes both electricity consumption and pro-
duction (e.g. from solar panels). Negative values are
permitted in U, PI, and PE, where they can be inter-
preted as follows: U(t) < 0 means that electricity pro-
duction would exceed consumption; PI(t) < 0 means
that payment would be received for consumption; and
PE(t) < 0 means that charges would be accrued for
(unwanted) supply. As mentioned before, dynamic
mise dynamic electricity costs, similar to the Power-
vault GridFLEX1 feature. Note that batteries can be
simulated in practice if the substantial cost of real bat-
teries precludes installation in homes for short-term
evaluations. The schedule itself is defined for some
fixed period into the future (e.g. one week). Obvi-
ous issues include that dynamic prices are typically
known only for the immediate future (e.g. at most 24
hours in advance for Octopus Energy), while future
consumption is typically unknown. Predicting future
prices and consumption thus presents avenues for the
use of machine learning, especially in the form of re-
gression and time series forecasting (Hyndman and
Athanasopoulos, 2018). Optimal scheduling of bat-
tery (dis)charge actions then presents avenues for the
use of AI planning (Geffner and Bonet, 2013). The
combination of these two subfields makes the applica-
tion a hybrid-AI system. Target XAI stakeholders are
non-experts occupying the home, with explainable AI
planning needed to explain the schedule, and explain-
1https://octopus.energy/blog/agile-powervault-trial/
intervals, so a reasonable interval length might be any
factor of 30 minutes (e.g. 5 minutes).
Definition 2. Let (b,s1,l,tmax,U,PI,PE) be a battery
scheduling problem. A battery scheduling model is an
MDP (S,A,T,C,tmax,s1) where:
• S = [0,b] is the set of (battery level) states
• A = { 1,0,1} is the set of (battery) actions with
1 the charge action, 1 the discharge action, and
0 the no-op action
• T : S⇥A ! S is the transition function defined for
each s 2 S and each a 2 A:
T(s,a) = min{b,max{0,s+al}} (2)
• C : S ⇥ D ⇥ A ! R 0 is the cost function defined
for each s 2 S and t 2 D as:
C(s,t,a) = u+
a PI(t)+ua PE(t) C⇤
(t) (3)
C⇤
(t) = min
(
u+
maxPI(t)+umaxPE(t),
u+
minPI(t)+uminPE(t)
)
(4)
where, given s and t:
ua =
8
>
<
>
:
U(t)+min{l,b s} if a = 1
U(t) min{l,s} if a = 1
U(t) if a = 0
(5)
umax = U(t)+l (6)
umin = U(t) l (7)
such that x+ = max{0,x} and x = min{0,x} for
any x 2 R
• tmax 2 N is the horizon with D = {1,2,...,tmax}
• s1 2 S is the initial state
Equation 4 is the minimal cost at timestep t 2 D
based on either (i) a negative import price and a full
ning on a 2016 MacBook Pro (2 G
Core i5 CPU, 16 GB 1867 MHz R
Example 2. Let b = 8 kWh, l =
kWh, and tmax = 2016 such that t
minute intervals, i.e. timesteps cov
(dis)charge takes 40 timesteps or
first plot in Figure 1 shows histo
import3 and export4 prices for the
7-day period starting 00:00 on 28
second plot shows real author-col
data for the same period. In the th
(resp. standard) price indicates th
be charged with (resp. without) o
tery. The fourth plot shows the ex
Timesteps map to e.g.
5-minute intervals
Predicted via
machine learning
Capacity e.g. 8 kWh
Rate e.g. 8 / 20 = 0.4 kWh
Cost-minimising MDP
with non-negative but
non-stationary costs
Deterministic
battery model
Standard actions
Continuous state space
Complete policy not needed
Finite horizon
7. Application 1a
Battery Scheduling (2)
Real historic data
Solution found by
uniform cost search
1-week period (i.e. 2016 timesteps lasting 5 minutes each)
Savings of £6.98
vs. no battery
8. Application 1b
Price Forecasting
ces have
ve pric-
ment for
ents oc-
d and it
rt prices
in some
supply-
oing so.
ity stor-
include
werwall.
batteries
if they
ed when
help to
lar con-
ble sup-
3 range
order to
5.38 per
hat cur-
y not be
ange in
y, or due
at-home
es have
supply
owances
ies con-
ds.
which is
to opti-
Power-
can be
able machine learning needed to explain predictions.
3.1.1 Scheduling Battery Control
We start by formalising the high-level AI planning
problem as follows:
Definition 1. A battery scheduling problem is a tuple
(b,s1,l,tmax,U,PI,PE) where:
• b 2 R 0 is the (battery) capacity constant
• s1 2 [0,b] is the current (battery) level
• l 2 [0,b] is the (dis)charge rate per timestep
• tmax 2 N is the horizon with D = {1,2,...,tmax}
• U : D ! R the (electricity) consumption forecast
• PI : D ! R the (electricity) import price forecast
• PE : D ! R the (electricity) export price forecast
Definition 1 assumes that all parameters are spec-
ified on the same unit scale (e.g. kWh). The function
U then encodes both electricity consumption and pro-
duction (e.g. from solar panels). Negative values are
permitted in U, PI, and PE, where they can be inter-
preted as follows: U(t) < 0 means that electricity pro-
duction would exceed consumption; PI(t) < 0 means
that payment would be received for consumption; and
PE(t) < 0 means that charges would be accrued for
(unwanted) supply. As mentioned before, dynamic
tariffs from Octopus Energy satisfy PI(t) 35p/kWh
and PE(t) 0p/kWh. We assume that timesteps map
to consecutive fixed-length time intervals. For exam-
ple, Octopus Energy prices are allocated in 30 minute
intervals, so a reasonable interval length might be any
factor of 30 minutes (e.g. 5 minutes).
Standard regressors using
time-based features
Additional features
9. Application 1c
Consumption Forecasting
ces have
ve pric-
ment for
ents oc-
d and it
rt prices
in some
supply-
oing so.
ity stor-
include
werwall.
batteries
if they
ed when
help to
lar con-
ble sup-
3 range
order to
5.38 per
hat cur-
y not be
ange in
y, or due
at-home
es have
supply
owances
ies con-
ds.
which is
to opti-
Power-
can be
able machine learning needed to explain predictions.
3.1.1 Scheduling Battery Control
We start by formalising the high-level AI planning
problem as follows:
Definition 1. A battery scheduling problem is a tuple
(b,s1,l,tmax,U,PI,PE) where:
• b 2 R 0 is the (battery) capacity constant
• s1 2 [0,b] is the current (battery) level
• l 2 [0,b] is the (dis)charge rate per timestep
• tmax 2 N is the horizon with D = {1,2,...,tmax}
• U : D ! R the (electricity) consumption forecast
• PI : D ! R the (electricity) import price forecast
• PE : D ! R the (electricity) export price forecast
Definition 1 assumes that all parameters are spec-
ified on the same unit scale (e.g. kWh). The function
U then encodes both electricity consumption and pro-
duction (e.g. from solar panels). Negative values are
permitted in U, PI, and PE, where they can be inter-
preted as follows: U(t) < 0 means that electricity pro-
duction would exceed consumption; PI(t) < 0 means
that payment would be received for consumption; and
PE(t) < 0 means that charges would be accrued for
(unwanted) supply. As mentioned before, dynamic
tariffs from Octopus Energy satisfy PI(t) 35p/kWh
and PE(t) 0p/kWh. We assume that timesteps map
to consecutive fixed-length time intervals. For exam-
ple, Octopus Energy prices are allocated in 30 minute
intervals, so a reasonable interval length might be any
factor of 30 minutes (e.g. 5 minutes).
Standard time
series forecasters
Additional features
?
10. Application 2
Background
• Smart thermostat
• Controls boiler
• Auto-schedule
• Auto-away
• Time-to-temperature
• Early-on
• …
• Smart thermostatic radiator valve (TRV)
• Controls radiator
• Zone-based auto-schedule…?
• Zone-based auto-away…?
• Etc.
Hallway
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
or dining won’t heat
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Living Room
Bathroom
Dining Room
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
or dining won’t heat
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
or dining won’t heat
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
or dining won’t heat
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Surprise! No controls needed.
Dining Room
used in the morning
used in the evening
Hallway
coldest room
smallest radiator
never really used
Living Room
used in the evening
always on
always hot
always hot
always hot
problems:
EVERYTHING
X°C
Hallway
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
or dining won’t heat
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Living Room
Bathroom
Dining Room
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
must be on in *morning
or dining won’t heat
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
(would hinder)
learn
schedule
auto-off
when away
weather
compensation
Only Smart Thermostat
Dining Room
used in the morning
used in the evening
Living Room
used in the evening
moderated
efficient*
on when
cold
+ smarts
problems:
Hallway
coldest room
smallest radiator
never really used
always hot
no TRV
learn
schedule
auto-off
when away
weather
compensation
X°C
X°C
X°C
X°C
Surprise! No controls needed.
Dining Room
used in the morning
used in the evening
Hallway
coldest room
smallest radiator
never really used
Living Room
used in the evening
always on
always hot
always hot
always hot
problems:
EVERYTHING
Master
controller
11. Application 2a
TRV Scheduling
secutive fixed-length time intervals, although interval
length is now explicitly encoded by D. For example,
if D = 12 then timesteps map to 5-minute intervals.
Definition 4. Let (t,x1,y1,s,w,l,D,tmax,H) be a
TRV scheduling problem. A TRV scheduling model
is an MDP (S,A,T,C,tmax,s1) where:
• S = R2 is the set of states with (x,y) 2 S such that
x is the radiator temperature and y is the room
temperature
• A = {0,1} is the set of (TRV) actions with 1 the
valve open action and 0 the valve closed action
• T : S⇥A ! S is the transition function defined for
each s 2 S and each a 2 A as:
x0
= min{t,max{5,x00
}} (8)
x00
=
(
x+ 12(t x)
D if a = 1
max{y0,x+ 4(y t)
D } if a = 0
(9)
y0
= y+
(a·s·b) w
l·D
(10)
b = 0.000112378·z2
+0.0143811·z (11)
where s = (x,y), z = x y, and T(s,a) = (x0,y0)
• C : S ⇥ D ! R 0 is the cost function defined for
each s 2 S and each t 2 D as:
C(s,t,a,s0
) = |y0
H(t +1)| (12)
where s0 = (x0,y0)
• tmax 2 N is the horizon with D = {1,2,...,tmax}
• s1 2 S is the initial state with s1 = (x1,y1)
Equations 8–11 define a simple building thermal
model (Bacher and Madsen, 2011) similar to Rogers
Figure 5: TRV problem and optim
C(s,t,a,s0). An (optimal) TR
mal) partial policy that is clos
Example 5. Let t = 60 C, x1
BTU/h, w = l = 500 BTU/h
timesteps map to 15-minute i
6 hours. Figure 5 then show
with expected room (resp. rad
executing the optimal TRV sc
(resp. second) plot, i.e. the TR
when the radiator temperature
creasing) or at boiler (resp. ro
TRV scheduling problem
ties as battery scheduling pr
expressed (compactly) in sta
guages, but non-negative cos
solved by standard search alg
ference for state-space search
problems exhibit a much larg
due to more complex dynam
formed search algorithms suc
can still find solutions, but in
decision horizons more advan
gorithms may be required. T
for a broad range of explain
ods, e.g. uninformed strategie
(and thus easier to explain) th
res are not readily avail-
redicting domestic elec-
heless, many time series
upport inclusion of addi-
ariate time series).
consumption predictions
om Darts. Models were
onsumption data for the
1 to 25 July 2021, inclu-
6 timesteps) reserved for
ures are timestamps and
otherwise, seasonality is
or all applicable models.
e top performing regres-
Exponential Smoothing
Note that the ensemble
m forest over two Naive
y and 7-day seasonality).
are a major category in
o et al., 2019). Success-
ude the ecobee range and
st Learning Thermostat.
en many relevant appli-
013; Yang and Newman,
ypical AI-based features
ating controls according
, cost, carbon emissions)
get XAI stakeholders are non-experts occupying the
home, with explainable AI planning needed to explain
the control schedule, and explainable machine learn-
ing needed to explain the learned heating schedule.
3.2.1 Scheduling TRV Control
Again we start by formalising the high-level AI plan-
ning problem as follows:
Definition 3. A TRV scheduling problem is a tuple
(t,x1,y1,s,w,l,D,tmax,H) where:
• t 2 R 5 is the (constant) boiler temperature in C
• x1 2 [5,t] the (current) radiator temperature in C
• y1 2 R is the (current) room temperature in C
• s 2 R 0 is the BTU–50 gain in BTU/h
• w 2 R 0 is the BTU loss in BTU/h
• l 2 R>0 is the BTU effort in BTU/h
• D 2 R>0 is the number of timesteps per hour
• tmax 2 N is the horizon with D = {1,2,...,tmax}
• H : {t +1 | t 2 D} ! R is the heating schedule
Definition 3 introduces parameters for our ther-
mal model, including properties of the heating system
and current environment. The heating schedule is de-
fined for t = tmax +1 but is undefined for t = 1. Note
that BTU (British Thermal Unit) is a standard unit of
heat. The BTU–50 gain for a radiator is determined
by s = e · a where e 2 [0,1] is the radiator efficiency
and a 2 R 0 is the radiator panel area in cm2. Stan-
dard efficiencies are: e = 0.55 for type 11 radiators
Timesteps map to e.g.
5-minute intervals
Predicted via
machine learning
Heating system
parameters
Cost-minimising MDP
with non-negative but
non-stationary costs
Deterministic
thermal model
Standard actions
Continuous state space
Complete policy not needed
Finite horizon
12. Application 2b
User Schedule Learning
• How does it work?
• Technology is trade-secret (Barrett and Linder, 2015)
• Not very well, according to users (Yang and Newman, 2013)
• Maybe apprenticeship learning (e.g. imitation learning or
inverse reinforcement learning)…?
• Imitation learning
• Learn policy (using supervised learning) that mimics
observed state-action pairs
• Inverse reinforcement learning
1. Learn reward function given observed state-actions pairs
2. Find policy that optimises learned reward function
13. Testbed
Hardware, Software, & User Interface
chapp-api
Python
Falcon
Bjoern
chapp-service
Python
Schedule
Scikit-learn
Darts
chapp-ui
HTML
CSS (Flexbox)
JavaScript
Chart.js
SQLite
chapp-setup
Debian
Bash
Nginx
HTTP
Python
Browser
Python
Other features
Electricity prices
Electricity consumption
Temperature
Battery control TRV control
14. Conclusion
• A testbed to support research studies evaluating XAI with non-experts
• Representative of real smart home applications (i.e. what non-experts are likely to encounter)
• Supports a range of AI tools in a modular fashion (i.e. easy to extend/adapt)
• Easy to deploy (provided software, low-cost hardware, etc.)
• Future work
• Improved dynamics, including learned dynamics (e.g. asymmetric charge rates, battery efficiency, weather conditions)
• Improved learning (e.g. additional data sources, optimised models, alternative models)
• Current outlook on research study
• Study scheduled for early 2023
• Meross smart plugs discontinued; looking for alternatives
• Highly unstable electricity prices; may exclude price forecasting
• Signed agreement with Ecobee; waiting for schedule learning dataset