-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add change point detection module. (#41)
* Implement various Bayesian conjugate priors. * Allow returning updated posterior after inference. * Allow creating TimeSeries from numpy directly. * Add testing for conjugate priors. * Let conj priors update on a single ts value. * Update docstring for SpectralResidual. * Initial implementation of BOCPD. * Update uninformative priors. The new uninformative priors allow estimation of prior probabilities without conditioning on any data. * Have BOCPD return z-score units. * Smarter prior initialization based on data. * Add BOCPD to API docs. * Use future look-ahead to aggregate probabilities. We consider a maximal look-ahead equal to the lag, and we allow the model to use data up to `lag` steps in the future to decide whether each point is a change point. This can greatly improve the batch prediction. * Update default BOCPD lag to None. * Automatic selection of Bayesian conjugate prior. * Remove unnecessary copying line. * Allow singular covariances in priors. * Fix an offset error in BOCPD dynamic programming. * Add explicit posterior for BayesianMVLinReg. * Use explicit posterior in BOCPD where possible. * Make sparse matrix allocation more efficient. * Use fully uninformative priors. Setting priors in a data-driven way led to over-estimating the probability of some change points. * Make sure matrices are non-singular. * Slightly refine min log likelihood calculation. * Add test coverage for BOCPD. * Make sure matrix is PSD as well as non-singular. * Allow BOCPD to predict on historical data. * Allow time series alignment for empty time series. * Make sure last_train_time is set in BOCPD.update * Build a predictive model for BOCPD. * Allow conjugate priors to make forecasts. * Add forecasting ability to BOCPD. * Train BOCPD on transformed time series. * Make format of model/config docs more consistent. * Add tests for BOCPD visualizations. * Update version. * Fix failing BOCPD tests. * Backwards compatibility for scipy 1.5. Scipy 1.6.0 introduced the multivariate_t random variable, which we use in our implementation of conjugate priors. However, scipy 1.6.0+ requires Python 3.7+. To maintain backwards compatibility with Python 3.6 (and therefore scipy 1.5), we implement the log density of the multivariate t distribution & use it as a fallback where necessary. We also implement an optimized computaiton of pseudo-inverse, and explicitly allow for singular V_0 matrices in the computation of the Bayesian Multivariate Linear Regression posterior. Finally, we update the testing workflows to avoid segfaults due to BLAS bugs in older package versions. * Allow integer # of time_stapms for BOCPD. * Remove issubclass check. * Add mentions of change point detection in the docs
- Loading branch information
Showing
44 changed files
with
1,894 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
merlion.models.anomaly.change\_point package | ||
============================================ | ||
|
||
.. automodule:: merlion.models.anomaly.change_point | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. autosummary:: | ||
bocpd | ||
|
||
Submodules | ||
---------- | ||
|
||
merlion.models.anomaly.change\_point.bocpd module | ||
------------------------------------------------- | ||
|
||
.. automodule:: merlion.models.anomaly.change_point.bocpd | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
# Copyright (c) 2021 salesforce.com, inc. | ||
# All rights reserved. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
# | ||
""" | ||
Contains all change point detection algorithms. These models implement the anomaly detector interface, but | ||
they are specialized for detecting change points in time series. | ||
""" |
Oops, something went wrong.