9/24/2010 Monitoring and data filtering III. The Kalman Filter and its relation with the other methods Advanced Herd Management Cécile Cornou, IPH Dias 1 Before this part of the course Compare key figures (k) with expected results κ = θ + e s + e o Results from 2 herds 880 870 860 850 840 Gain (g) 830 820 810 800 790 780 0 2 4 6 8 10 12 Quarter Expected Herd A Herd B Dias 2 The methods we looked at – In part I of the course (1/3) Key figures regarded as a time series of observations, treated as a whole κ = θ + e s + e o κ t = θ + e s t + e o t = θ + v t I - Shewart Control Chart - Plot our Time Series of Observations : raw observations - Plot our Target Value ( θ’ ) - Plot of Control Limits (UCL & LCL) Not so good ... for our type of data ... Dias 3 1
9/24/2010 The methods we looked at – In part I of the course (2/3) II - Shewart Control Chart III - Shewart Control Chart - Plot a Moving Average of our TS - Plot a EWMA of our TS - Plot our Target Value ( θ’ ) - Plot our Target Value ( θ’ ) - Plot of Control Limits (UCL & LCL) - Plot of Control Limits (UCL & LCL) Still not so good Here: milk yield ... for our type of data Dias 4 The methods we looked at – In part I of the course (3/3) IV – Autocorrelated data V – EWMA for autocorrelated data - Use EWMA as one-step-ahead - Model the data - Calculate a prediction for next obs. predictor - Plot the prediction errors - Plot the prediction errors Here we use 0 as Center Line and see how error terms are distributed Dias 5 The methods we looked at – In part II of the course (1/4) Before: κ t = θ + e s t + e o t = θ + v t A Simple DLM Time series Y t = (y 1 , ... , y n ) Observation equation: y t = t + v t , v t » N(0, V t ) Like before: v t = e s + e o The symbol t is the underlying true value at time t . System equation: t = t -1 + w t , w t » N(0, W t ) The true value is not any longer assumed to be constant . Dias 6 2
9/24/2010 The methods we looked at – In part II of the course (2/4) The Kalman Filter ( t-1 | D t-1 ) » N(m t-1 , C t-1 ) ( t | D t ) » N(m t , C t ) The updating equations of the Kalman Filter are used for stepwise calculation of m t and C t DLM and EWMA DLM EWMA m A Y ( 1 A ) m z ( 1 ) z t t t t t 1 t t t 1 As the model adapts to the data, A t converges and becomes A The calculation of the mean of the underlying level for the simple DLM looks very similar to the calculation of the EWMA Dias 7 The methods we looked at – In part II of the course (3/4) The different models - Simple DLM - DLM with a trend General form of the DLM Observation Equation: Y t = F’ t θ t + ν t , ν t ~ N(0,V t ) System Equation: θ t = G t θ t-1 + ω t , ω t ~ N(0,W t ) t = ( 1 , … , m )’ is a vector of parameters describing the system at time t. Can include: Level, Trend, + External information Structure Seasonality, Periodicity, ... According to the data observed, the use of DLM allows many modeling possibilities Dias 8 The methods we looked at – In part II of the course (4/4) Monitoring methods used with DLM Monitor the forecast errors (e t = Y t – f t ) as we did with autocorrelated data in part I NO need for ’expected value’ V-mask Tabular cusum Can look at the different components of the models (trends, seasons) Dias 9 3
9/24/2010 Further examples Ex 1. Monitoring activity level A simple DLM Monitoring deviations by mean of V-mask and Tabular cusum Ex. 2. Monitoring sows’ activity types in farrowing house Use of a MPKF of class I Dias 10 Example 1. Monitoring activity level Context Development of Group housing in EU results of Council Directive 2001/88/EEC Difficulties identifying and accessing individual sow Idea Store data in a chip and transmit info to the farmer’s PC Sensor in the chip allows to monitor activity of the sow Assumption Body Activity of sows is expected to change around the onset of oestrus Objective Develop an automated oestrus detection method for group housed sows using sows’ acceleration measurements Method Use of Dynamic Linear Models to model the sows’ activity Use of control methods that detects model deviations at the onset of oestrus Dias 11 Outdoor facilities Dias 12 4
9/24/2010 3 D accelerometer The large pen Animals and Housing • 5 sows in group of 100 • 20 days Activity Measurements • Acceleration in 3 dimensions • Four measurements per second • Transfer PC via Blue Tooth Video Recordings • Four cameras used as web cam Oestrus Detection • Golden standard ACTIVITY Detect whether activity pattern changes at onset of oestrus Dias 13 Definition of the DLM Use hourly averages of the length of the acceleration vector 2 + acc y 2 + acc z Y t = acc = √ (acc x 2 ) Observation equation: k t = θ t + v t , v t » N(0, V t ) System equation: θ t = θ t -1 + w t , w t » N(0, W t ) V t = V= unknow and constant W t = 0 (In normal condition: no change in activity) Model initialized by mean of Reference Analysis Model observations (Y t ) weighted by number of observations per hour Missing observation: e t =0 Dias 14 Illustration Model Cusum V-mask Tabular Cusum Dias 15 5
9/24/2010 Example 2. Monitoring sows’ activity types Farrowing house Assumption Sow’s behaviour is affected by physiological state / illness Accelerometer: measured any time / during whole reproductive cycle Objective Develop a method that automatically classify sows’ activity types Model selected activity types using DLM Classify each activity type using a Multi Process Kalman Filter See whether we can automatically detect the onset of farrowing Dias 16 The Farrowing House Dias 17 Farrowing Data Collected – Farrowing house Dias 18 6
9/24/2010 Time series and activity types Activity types Extracts from time series of acceleration are associated to 5 activity types • High Active (HA) 3 dimensions: X,Y , Z • Medium Active (MA) • Passive Lying Side 1 (L1) • Passive Lying Side 2 (L2) • Passive Lying Sternally (Ls) Learning data set: X 10 minutes of each activity type Y Estimate the model parameters Z Dias 19 Dynamic Linear Model Dynamic Linear Models (DLMs) combined with Kalman Filter (KF) General form of the DLM Observation Equation: Y t = F’ t θ t + ν t , ν t ~ N(0,V t ) System Equation: θ t = G t θ t-1 + ω t , ω t ~ N(0,W t ) DLM combined with Kalman Filter: estimate the underlying state vector θ t by its mean vector m t and its variance-covariance matrix C t . x Multivariate DLM: each observation is a 3-dimensional vector Y t y z V (3 x 3) and W (3 x 3), characteristic of each activity, are estimated by EM algorithm 5 DLMs (5 activities) Dias 20 Multi Process Kalman Filter MPKF class I At time t : Each DLM is analysed using the updating equations of the Kalman Filter: • One step forecast mean f t • One step forecast variance Q t Posterior Probabilities are estimated for each DLM Dias 21 7
9/24/2010 2 days before Activity Classification – Farrowing farrowing Feeding: 7.15, 12.00, 15.30 Active Lying side 1 Lying sternally Lying side 2 Dias 22 Farrowing Activity Classification – Farrowing day Feeding / Rooting / Nesting Active Lying side 1 Lying sternally Lying side 2 Dias 23 Activity Classification – Farrowing Percentage of activity types d-3 to d+1 Dias 24 8
9/24/2010 Activity Classification – Farrowing Sum of 2 min HA (red), MA (orange) and Passive (blue) / hour Farrowing Cusum of HA t – HA t-24 Dias 25 The multi process kalman filter (MPKF) (1/2) Multi Process Models Class I ex: Classifying sows activities in Farrowing house A single out of a range of possible DLMs is viewed as appropriate at all time for describing the entire time series Parameters : V and W We try to find out which model is it at time t? Dias 26 The multi process kalman filter (MPKF) (2/2) Multi Process Models Class II ex: Monitoring Somatic Cell Counts / Boar visits No single DLM as adequate for all time: the possibility that different models are appropriate at different times is explicitly recognised and modelled through different defining parameters Parameters : V and W and Π (values for Π define fixed prior probabilities) We try to find out normal evolution, outlier, level shift We need to go back f.x. two, three steps to check which model is the right one Dias 27 9
9/24/2010 Sum up of sum up We increased the complexity of our models and monitoring methods to try to adapt to the complexity of monitoring living beings Methods here based on a whole time series of observations -> need for automatic registration -> potential on-line monitoring From part I to part II, we made our model dynamics, so the ’true underlying level’ is no more constant Dias 28 10
Recommend
More recommend