Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Change point detection and prediction #92

Merged
merged 41 commits into from
May 11, 2018

Conversation

tveasey
Copy link
Contributor

@tveasey tveasey commented May 11, 2018

This implements a mechanism to detect specific types of change points in a time series; specifically, 1) step change, 2) linear scaling and 3) time shift (e.g. for daylight saving). These are then applied to the time series model in one shot (rather than gradually relearning its parameters). In addition, it introduces a new probabilistic model to predict when step changes might occur in the future and uses this to roll out possible future paths for the time series including steps.

The fact that we can now detect specific types of change points has also meant that we can increase the model robustness w.r.t. outliers, since behaviour at significant change points doesn't as strongly rely on being able to adjust the model parameters with unusual values.

From an anomaly detection perspective this means we can adjust the model with significantly less growth in prediction uncertainty when the time series undergoes one of the modelled class of changes. This results in fewer blind spots in detection for such signals. From a forecasting perspective, signals with predictable discontinuities, such a garbage collection, are much more accurately predicted.

This PR commits the long running task on change point detection and modelling to master. Note that these changes have already been individually reviewed.

tveasey and others added 30 commits March 9, 2018 12:42
…tection and modelling (#9)

This implements 1) a naive Bayes classifier, using our distribution models, which will be used 
for modelling the probability of a change, and 2) a change detector framework, currently 
supporting detecting level shifts and time shifts, which works by comparing BIC of the various 
possible hypotheses against one another and a null hypothesis that there is no change.
… model (#11)

This wires in change detection and starts some unit testing of CTimeSeriesModel with change 
points. There is some more work to be done to avoid using level shifts to try and fit other types 
of change points, such as scaling.
)

This implements an absolute "goodness-of-fit" test for each change, by additionally testing a 
change versus its expected BIC given the residual distribution. It means we will only accept 
changes if they are a reasonably accurate description of the change currently occurring in the 
time series.
This implements detection of linear scaling events. It also finishes up the unit testing of change 
detection and fixes some issues these turned up: specifically, 1) the behaviour when a change is 
detected but the trend model has no components, 2) the handling of time shifts in the trend 
model and 3) the handling of data types in the trend component change model. Finally, we are 
now more careful with the weights we apply to samples added to both the standard and change 
models. This has meant I've been able to revert scaling the changes, since the trend is less 
influenced by values during the change detection period if we're likely to detect a change.
@droberts195
Copy link
Contributor

When this is backported to 6.x there are now two extra fixes that need cherry-picking at the same time: d89d6b5 and 799d6b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants