a hierarchical hmm framework for home appliance modelling 200301_a_hhmm... · menu 1 abstract 2...
TRANSCRIPT
wang.wei shared ppt
A hierarchical HMM framework for home appliance modelling
Weicong Kong
March 1, 2020
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 1 / 38
Menu
1 Abstract
2 Introduction
3 Model Representations
4 MODEL FITTING
5 Modelling real world appliance with hhmm
6 Load disaggregation with HHMM
7 Conclusion
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 2 / 38
Abstract
Abstract
whyProper individual home appliance modeling is critical to the performance of NILM.
This model aims to provide better representation for those appliances that havemultiple built-in modes.
whatThe dynamic Bayesian network representation of such an appliance model is built.
A forward-backward algorithm, which is based on the framework of expectationmaximization, is formalized for the HHMM fitting process.
howTests on publically available data show that the HHMM and proposed algorithmcan effectively handle the modeling of appliances with multiple functional modes,as well as better representing a general type of appliances.
A disaggregation test also demonstrates that the fitted HHMM can be easilyapplied to a general inference solver(particle filter) to outperform conventionalhidden Markov model in the estimation of energy disaggregation.
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 3 / 38
Introduction
NILM problems during steps
Figure 1: NILM problems during steps
Problem statement yt =∑k
fk(xkt ) + et
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 4 / 38
Introduction
Introduction
HMM with low frequency data(first 3 paragraphs)The advent of smart meter infrastructure has provided plentiful information ofstudying load characteristics, but research in mining such big data to provideactionable insights is still at the early stage.
Load disaggregation is one of the key directions...
low frequency sampling data with HMM model is attracting attention.
HMM not ok with two/multiple mode 4th paragraphbut ... have difficulty to distinguish the standby state and the off state.
for multiple mode appliances,...not be captured, depending on user’s behaviour
re-usability of such model is compromised in the load disaggregation problem
HMM variant with hierarchical structurein the area of speech, Cocktail Party Problem
hierarchical HMM is adopted
two Markov chain, upper chain(the mode of appliance), lower chain(power profileof the specific mode)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 5 / 38
Introduction
previous HHMM
Figure 2: prevois HHMM,model as DBN
Wong, Yung Fei, Thomas Drummond, and Y. A. Sekercioglu. ”Real-time loaddisaggregation algorithm using particle-based distribution truncation with stateoccupancy model.” Electronics Letters 50.9 (2014): 697-699.
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 6 / 38
Introduction
previous Sequential Monte Carlo/particle filter for localization simulation
Figure 3: previous Monte Carlo/particle filter for localization simulation
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 7 / 38
Introduction
Monte Carlo Localization flow
Figure 4: Monte Carlo Localization flow
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 8 / 38
Introduction
Why The particle filter solver for NILM with DBN model
Figure 5: NILM using particle filter
non-linear, non-Gaussian Ditribution
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 9 / 38
Model Representations
Hidden Markov Model
Figure 6: Graphical illustration of a HMM.
Hmm provides a good framework to describe the dynamic through discretised timeseries of individual appliances.
πi = P (X1 = i) (1)
Ai,j = P(Xt = j
∣∣Xt−1 = i)
(2)
P(yt∣∣Xt = i
)∼ N (µi, σi) (3)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 10 / 38
Model Representations
Hierarchical Hidden Markov Model(HHMM)
an extension of HMM to hierarchical hidden markov model
dynamic bayesian network
Figure 7: The state transition diagram for a two-level HHMM, modelling a 3-state appliance.
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 11 / 38
Model Representations
HHMM
Figure 8: Graphical illustration of a two-level HHMM.
P(XLt = j
∣∣∣XLt−1 = i , Ft−1 = f,XU
t = κ)
=
{ALκ (i, j) if f = 0
πLκ ( j) if f = 1(4)
1 XUt , X
Lt−1: state variables of upper/lower level at time t
2 Ft−1: binary auxiliary variable, 1: lower level HMM finished,0: not finished3 ALκ (i, j) is rescaled version of ALκ (i, j)4 πLκ ( j) is the distribution for initial state for the low level
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 12 / 38
Model Representations
HHMM eq5-9
1 The relationship between the subHMM transition matrix and rescaled matrix:
ALκ (i, j)(1−ALκ (i, end)
)= ALκ (i, j) (5)
ALκ (i, end) is the probability of a state being terminiated from state iK∑j=1
ALκ (i, j) = 1
P(Ft = 1
∣∣XLt = i,XU
t = κ)= ALκ (i, end) (6)
P(Ft = 0
∣∣XLt = i,XU
t = κ)= 1−ALκ (i, end) (7)
P(XUt = κ
∣∣XUt−1 = η, Ft−1 = f
)=
{δ (η, κ) if f = 0
AU (η, κ) if f = 1(8)
P(XU
1 = κ)= πU (κ) (9)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 13 / 38
MODEL FITTING
Model fitting
θ denote the of paramters, θ is the estimated value, y = y1:T is the wholeobserved sequence
θ = argmaxθP (y|θ) (10)
the famous algorithm is expectation maximization (EM) algorithm
EM for HMM
EM for HHMM
HMM fitting by adopting the dynamic bayesian network representation
for simplicity, P (y|θ) = P (y1:T )
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 14 / 38
MODEL FITTING
Expectation Maximization for HMM
the first version of forward variable
αt( j) = P (Xt = j, y1:t) (11)
The normalized version adopted for forward variable in this paper
αt( j) ,P (Xt = j, y1:t)
P (y1:t)= P
(Xt = j
∣∣y1:t)∝
(K∑i=1
αt−1(i)Ai,j
)P(yt∣∣Xt = j
)(12)
backward variable
βt(i) , P(yt+1:T
∣∣Xt = i)=
K∑j=1
Ai,jP(yt+1
∣∣Xt+1 = j)βt+1( j)
(13)
the base case for both forward and backward variables
α1( j) = P(y1∣∣X1 = j
)πj (14)
βT (i) = 1 (15)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 15 / 38
MODEL FITTING
Expectation Maximization
The probability of each state at t given observation sequence
γt(i) , P(Xt = i
∣∣y1:T )=
1
P (y1:T )P(yt+1:T
∣∣Xt = i)P(Xt = i
∣∣y1:t)∝ αt(i)βt(i) (16)
ξt(i, j) , P(Xt−1 = i,Xt = j
∣∣y1:T )∝ P
(Xt = j
∣∣Xt−1 = i)× P
(Xt−1 = i
∣∣y1:t−1
)× P
(yt+1:T
∣∣Xt = j)× P
(yt∣∣Xt = j
)= Ai,jαt−1(i)βt( j)P
(yt∣∣Xt = j
)(17)
γt(i) and ξt(i, j) is the estimation step of EM
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 16 / 38
MODEL FITTING
Expectation Maximization
The maximization step of EM
πi = γ1(i) (18)
Ai,j =1
Z
T∑t=2
ξt (i, j) (19)
yt(i) = γt(i)× yt. (20)
parameters by fitting a Gaussian distribution using a maximum likelihood estimate
Z is a normalizing constant to ensure the transition matrix is a stochastic matrix
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 17 / 38
MODEL FITTING
Number Underflow
as the length of sequence grows, the joint probability keeps decreasing.
the value exceed the maximum length which the computer can represent, resultingthe value to be considered to 0
to deal with this issue, using log
normalization is also performed in log space to mitigate the effect,∑j
exp(αt(j)) = 1
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 18 / 38
MODEL FITTING
The log likelihood of model parameters
the forward variables be rewritten into
αt( j) = P(Xt = j
∣∣y1:t)=
1
P (yt| y1 : t−1)P(Xt = j, yt
∣∣y1 : t−1
)(21)
letting ct = P (yt|y1 : t−1),then
ct =∑j
P(Xt = j, yt
∣∣1 : t−1
)(22)
P(Xt = j, yt
∣∣y1:t−1
)=
(K∑i=1
αt−1(i)Ai,j
)P(yt∣∣Xt = j
)likelihood of observation can be calculated
P (y1:T ) = P (y1)P(y2∣∣y1) · · ·P (yT ∣∣y1:T−1
)=
T∏t=1
ct (23)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 19 / 38
MODEL FITTING
Expectation Maximization for HHMM
the set of parameters for a HHMM
Θ ={AU , πU ,
{ALκ
},{πLκ
},{ALκ (:, end)
},O}
(24)
every level has its unique state labels
upper level ON,OFF
lower level 1,2,3
the vertical transition matrix is sparse because the lower level is 1 where the upperlevel is off
i.e.P (XLt = 1|XU
t = OFF ) = 1
P (XLt = 2|XU
t = OFF ) = 0, P (XLt = 3|XU
t = OFF ) = 0
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 20 / 38
MODEL FITTING
The forward variables of EM in HHMM
According to this stable labelling setting
αt ( j, κ, f) , P(XLt = j,XU
t = κ, Ft−1 = f∣∣y1:t)
∝ P(yt∣∣XL
t = j)∑
i
∑η
h (i, η)∑g
αt−1 (i, η, g)
(25)
κ is the state of the upper level
h is an auxiliary function
h (i, η) =
{(1−ALη (i, end)
)δ (η, κ) ALκ (i, j) if f = 0
ALη (i, end)AU (η, κ)πLκ ( j) if f = 1(26)
the initial forward variable
α1 ( j, κ, f) =
{0 if f = 0
πU (κ)πLκ ( j)P(y1∣∣XL
1 = j)
if f = 1(27)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 21 / 38
MODEL FITTING
The backward variables
backward variable
βt (i, η, f) , P(yt+1:T
∣∣XLt = i,XU
t = η, Ft−1 = f)
=∑j
P(yt+1
∣∣XLt+1 = j
)∑κ
((1−ALη (i, end)
)× δ (η, κ)× ALκ (i, j)× βt+1 (j, κ, 0) +ALη (i, end)
×AU (η, κ)× πLκ ( j)× βt+1 (j, κ, 1))
(28)
the initial backward variableβT (i, η, f) = 1 (29)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 22 / 38
MODEL FITTING
Sufficient Statistics 1
horizontal transition probability
ξht (i, j, κ) = P(XLt−1 = i,X
L
t = j,XUt = κ, Ft−1 = 0
∣∣y1:T)∝∑η
∑g
αt−1 (i, η, g)×(1−ALη (i, end)
)× δ (η, κ)× ALκ (i, j)× P
(yt∣∣XL
t = j)
× βt (j, κ, 0) (30)
vertical transition probability
ξvt (j, κ) = P(XLt = j,XU
t = κ, Ft−1 = 1∣∣y1:T)
∝ αt ( j, κ, 1)βt (j, κ, 1) (31)
smoothed state probability
γt (j, κ, f) = P(XLt = j,XU
t = κ, Ft−1 = f∣∣y1:T)
∝ αt (j, κ, f)βt (j, κ, f) (32)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 23 / 38
MODEL FITTING
Sufficient Statistics 2
end transition probability
ξet (i, η, 1) = P(XLt = i,XU
t = η, Ft = 1∣∣y1:T)
∝∑j
∑κ
∑f
αt (i, η, f)×ALη (i, end)
×AU (η, κ)× πLκ ( j)
× P(yt∣∣XL
t = j)× βt+1 (j, κ, 1) (33)
ξet (i, η, 1) denotes the probability that subHMM endsξet (i, η, 0) denotes the probability that subHMM not ends
ξet (i, η, 0) = P(XLt = i,XU
t = η, Ft = 0∣∣y1:T)
∝∑j
∑κ
∑f
αt (i, η, f)
×(1−ALη (i, end)
)× δ (η, κ)
× ALκ (i, j)× P(yt+1
∣∣XLt+1 = j
)× βt+1 (j, κ, 0) (34)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 24 / 38
MODEL FITTING
Sufficient Statistics 3
horizontal transition probability for the upper level
χt (η, κ) = P(XUt−1 = η,X
U
t = κ, Ft−1 = 1∣∣y1:T)
∝∑i
∑j
∑g
αt−1 (i, η, g)×ALη (i, end)
×AU (η, κ)× πLκ ( j)
× P(yt∣∣XL
t = j)× βt (j, κ, 1) (35)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 25 / 38
MODEL FITTING
The maximization step
the contribution of an observation to a concrete state i
yt(i) =
(∑κ
γt (i, κ)
)× yt (36)
the lower level transition parameters
AL
κ (i, j) =1
Zh
T∑t=2
ξht (i, j, κ) (37)
Zh is the normalizing constant to ensure the is a stochastic matrixthe end transition parameters
ALκ (i, end) =
1
Ze
T−1∑t=1
ξet (i, κ, 1) (38)
Ze is the normalizing constant matrix for the end transitions
Ze (i, η) =
T−1∑t=1
∑g
ξet (i, κ, g) (39)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 26 / 38
MODEL FITTING
The maximization step
the initial state distribution parameters at the lower level
πLκ ( j) =1
Zv
T∑t=1
ξvt (j, κ) (40)
the transition parameter at the upper level
AU (η, κ) =1
ZU
T∑t=2
χt (η, κ) (41)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 27 / 38
MODEL FITTING
The proposed EM algorithm for HHMM
Figure 9: The proposed EM algorithm for HHMM
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 28 / 38
Modelling real world appliance with hhmm
fitting single mode appliances and its benefit
modelling real world appliances with our proposed model and fitting algorithm
in NILM area, most neither state the length of the power profiles nor used a ratherlengthy sequence for fitting model
lengthy sequence not represent good generality
so..only use one typical duty cycle which eliminating the possibility of including theextra information
test the proposed model using publically available data introduced by..
typical duty cycle power sequence
i.e. typical one of washing machine: normal wash, permanent press and delicatewash. The power consumption pattern differ from each other.
down-sampled to 1 reading per minute
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 29 / 38
Modelling real world appliance with hhmm
fitting multiple mode appliances and its benefit
the proposed algorithm is applied ...yield three HHMMs
three HHMMs assembled to one HHMMassembling rule
1 without further information2 upon finishing any of the modes, should go back to the OFF mode
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 30 / 38
Load disaggregation with HHMM
Synthesis test case design
the proposed HHMM can be learned via EM
then apply the learned models in the NILM
the dataset include typical cycles of 7 major appliance typesthe difficulty of NILM are how mixed at same period
I randomly mix a random set of 7 appliance into a short 3 hour peroidI generate sufficiently complicated test casesI in order to present the varying complexity and diversity of reallife situations, 30 test
cases
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 31 / 38
Load disaggregation with HHMM
The particle filter solver
the particle filter solver adopted to NILM with HMM [12][24][25]
the pros of the PF solver: linear scalability with number of appliances
the con of the PF solver: slow
have not PF solver with HHMM, but in this paper
PF for HHMM should have an upper state sequence sampled in real time. Thelower state transition governed by the upper.
the upper state for appliance n at time t of particle m:
xU(n)t [m] =
xU(n)t−1 [m] if f = 0
∼ AU(n)
xU(n)t−1 [m],∗
if f = 1(42)
∼, the distribution of random variable, m is the particle index, A is the statetransition matrix
xL(n)t [m] ∼
AL(n)
xU(n)t−1 [m]
(xL(n)t [m], ∗
)if f = 0
πL(n)
κxU(n)t−1 [m]
if f = 1(43)
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 32 / 38
Load disaggregation with HHMM
The particle filter solver
assuming a load disaggregation problem with N appliances, T time stepseach appliance with KU upper state and KL lower state
Figure 10: NILM using particle filter
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 33 / 38
Load disaggregation with HHMM
The evaluation metric
there are numberous evaluation metrics for load disaggregation
not only the on/off events of each appliance, but also the amount of powerconsumption
The metric is calculated by
Acc = 1−
∑Tt=1
∑Nn=1
∣∣∣y(n)t − y(n)t
∣∣∣2∑Tt=1 yt
(44)
y(n)t denotes the estimate of power consumption for the ith appliance at time t
y(n)t denotes the actual power consumption for the ith appliance
yt denotes the observed power consumption sequence
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 34 / 38
Load disaggregation with HHMM
results and comparison
30 cases 4 different scenarios using particle filter solver
the number of particles is fixed to 5000
from table v, HHMM outperformance the conventional HMM
from fig.11, HHMM more stabe than HMM
fig.12-16, more benefit of HHMM
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 35 / 38
Load disaggregation with HHMM
real world test case REDD dataset
further justify proposed model, apply PF with HHMM to the REDD dataset1 not provide the detailed information about appliance modes2 real world dataset confirm the potential of HHMM3 although the performance decreases as the number of appliances increase4 one of the causes is that most appliances in real world pratice have muliple modes
but modelled as single-mode
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 36 / 38
Conclusion
Conclustion
this paperI inpired by the speech recognitionI more concise EM for HHMM fittingI comprehensive test verified better result in NILM
theoretical progressI the efficiency of sequential Monte Carlo (SMC) for performing inference in structured
probabilistic modelsI and the flexibility of deep neural networks to model complex conditional probability
distributionsI i.e.AUTO-ENCODING SEQUENTIAL MONTE CARLO (ICLR 2018)
Scenario, inference in embedded system, time consuming before the deadline, inorder real time control
I need the explainable inference modelI training or fitting model parameter in the cloud
future workI dataset format:I model:HHMM extend to combine with other sophisticated i.e. HSMMs, HMMsI fitting:more efficient solver with HHMMI solver:I evaluation:...plenty of spaceI loc-aware disaggregation
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 37 / 38
Conclusion
Thank You!
Weicong Kong A hierarchical HMM framework for home appliance modelling March 1, 2020 38 / 38