Kalman Filter Changepoint Detection and Trend Characterization
Kalman Filter Changepoint Detection and Trend Characterization
,(((
The paper is organized as follows. Section 2 describes the These account for the unknown or un-modeled dynamics of
data used for development and test. Next, Section 3 provides the system, amongst other things. The Kalman filter is an iter-
the details of Kalman filter changepoint detection. Section 5 ative algorithm that performs the prediction and update steps
presents results and Section 6 provides a discussion. at each iteration to estimate the true state of the system.
One of the big design questions is what form the Kalman
2. DATA filter should take. This is heavily dependent on the domain
and what it is that is trying to be tracked. In our application,
In this work we use electrocorticographic (ECoG) data our dataset consists of neural recordings which all start with a
recordings obtained from five neurosurgical patients (4 males, baseline, or resting, period where there is not expected to be
1 female) undergoing surgical treatment of medically in- large amplitude high gamma activity. Thus, each example in
tractable epilepsy. Informed consent was provided from all our dataset is expected to have a half second period where the
subjects and research protocols were approved by the appro- signal is centered around zero. Thus, to start, our initial trend
priate institutional review board. should be flat and centered around zero. We want anything
For more complete information on the data, task, prepro- that deviates from this to trigger a changepoint.
cessing, and clustering steps refer to [13], which we briefly When activity does change from this initial trend, we want
summarize here. ECoG data is collected from electrodes to note both that it changed and track the new trend, or state.
placed on the surface of the brain. Recordings were made We wish to track the dynamics of the trend, and not just a sim-
while subjects were awake and undergoing a speech task, ple bias, and thus we setup our Kalman filter to track both the
where they were repeating words visually presented to them value and the rate of change of the observations, or simply the
on a screen. Data was preprocessed to remove bad channels observation and rate. Going beyond this linear representation,
and artifacts through manual inspection and kurtosis analy- to polynomials or other nonlinear representations, may help to
sis. Next we extracted gamma frequency (70-150 Hz) power, better characterize some individual trends, but suffers from a
which has been linked to local neural processing [14]. Only loss of the ability to compare and understand the differences
electrodes showing a significant response to the speech task across trends. Therefore, we use a linear representation in
were kept. our application. Further, our approach here is different from
High gamma power responses from individual electrodes others which capture the value of the observations, but not
were segmented into trials based on the task. Each trial was 3 the rate. These approaches struggle to track transients, which
seconds long and sampled at 1 kHz, with the first 0.5 seconds are important for our dataset. Lastly, by using a data-driven
capturing baseline, non-speech, activity. Trials were then methodology we allow for the recorded data to drive the pa-
aligned to get average responses for each electrode. Average rameters of the model, moving away from the priors and thus
responses were z-scored based on baseline periods, which being more representative of the actual dataset instead of ex-
can be assumed to be Gaussian. Then responses were scaled pectations.
to fall between [0, 1]. Hierarchical agglomerative clustering In the rest of this section we walk through the parts of the
was performed across electrodes to get a set of characteristic model and extensions that we have added to it, starting with
activity patterns. Kalman filter changepoint detection was an illustrative example of the approach to provide intuition.
performed on these patterns to perform characterization.
The focus of this paper is on characterizing the results 3.1. Illustrative Example
from this dataset. While the focus is on this particular dataset,
it has applicability to other domains and applications where
the data is formatted similarly or can be transformed into a
similar representation. For simplicity, we will refer to the
collection of activity patterns as the dataset and an individ-
ual pattern as an example moving forward.
3. METHOD
3.7. Re-initialization To further test, we ran this algorithm over other ECoG
data sources that were characterized by more than just the
The last addition that we need to make to enable Kalman fil- symmetric and ramp shapes. We will not detail the charac-
ter changepoint detection is to re-initialize new filters when a terizations of those shapes here, but will provide results from
changepoint is detected. To re-initialize a filter, all parame- these datasets to show the validity of the method in Section 5.
ters are reset to their initial values, as stated above, with a few
exceptions now described. First, the estimated activity rate, 5. RESULTS
rest , is calculated based on the local observations around the
changepoint and is used to seed the estimated activity rate. In In Figure 3, results from the primary dataset are shown. It
our application we do not need to perform online estimation, can be seen that the ramp and symmetric shape are the two
so have availability of observations beyond our current time characteristic shapes displayed. Some of the shapes have a
point. We therefore use 100ms of data to recalculate a trend, brief transient period where activity slowly starts ramping up,
for similar reasons as setting α. To do so, we use 10% of before it reaches its full activity increase rate. In these cases,
data from the past and 90% in the future of the changepoint, deviations between the Kalman filter trace (red) and exam-
or what data is available if we approach boundary conditions ples (blue) can be seen prior to the first changepoint (green),
(which was not the case in our application). If we were per- indicating that the trend captured in the model is getting less
forming online calculation, we would have to allow for time indicative of the underlying process. Thus, changes occur and
to pass to get enough observation to reinitialize the next fil- two trends are needed to fully characterize the rise activity.
ter and hence no changepoints could occur during this time. In Figure 4, results from more variable ECoG traces are
The estimated covariance, P, is recalculate using the same shown. These results show that the method still holds when
data as rest , and with the same comment for extending to an there are changing trends during an increase, multiple peaks,
online application. We reset our state estimate, X(i, :), to broad plateaus, and changing trends during the decrease.
T
[Z(i), rest ] . The method applied to this dataset was trained on the above
approach tries to keep things relatively flat and does not do a
good job of capturing slope.