Package: changepoynt
Python Changepoint Detection (changepoynt)Table of content:QuickstartExamplesAlgorithmsInstallationContributingOutlookThis is the repository hosting thepip-installablepython package changepoynt. It implements several
change point detection techniques, while focusing mostly on "localized" algorithms, that could be run in an online
fashion.Current algorithms come from the field of:Subspace Estimation (Extracting the characteristic signals)Statistics (Detection of Change in the statistical properties)Time Series Segmentation (Algorithms focused on comparing time series shape)The package is aimed at execution performance (using JIT compilation and standing on the shoulders of giants like numpy
and scipy) while also keeping code readable and maintainable. This includes comments as well as architectural choices.
This might not be perfect, but we are trying!All of our algorithms are implementations of a base changepoint detection interface and therefore are interchangeable.
Currently, we are focused on shifting to the very common and existing sklearn interface of fit and transform. This
enables our algorithms to be part of the standard sklearn pipeline for preprocessing.Quick StartIf you want to start using the package right away, we recommend to use one of the singular spectrum transformation
algorithms (SST). The first step is to install the package using pip. Then you can use the following example code:importnumpyasnp# for signal creationimportmatplotlib.pyplotasplt# to show the plotfromchangepoynt.algorithms.esstimportESST# import the scoring algorithmfromchangepoynt.visualization.score_plottingimportplot_data_and_score# import a visualization function# simulate a signal that goes from exponential decline into a sine wave# the signals is only for demonstration purposes and can be replaced by your signalsteady_before=np.ones(200)exp_signal=np.exp(-np.linspace(0,5,200))steady_after=np.exp(-5)*np.ones(150)sine_after=0.2*np.sin(np.linspace(0,3*np.pi*10,300))signal=np.concatenate((steady_before,exp_signal,steady_after,sine_after))signal+=0.01*np.random.randn(signal.shape[0])# add some minor noise# This part is all you need to do to score a signal with our package# create the scorer and compute the change scoredetector=ESST(30)detection=detector.transform(signal)# make the plot using the built-in function of the packageplot_data_and_score(signal,detection)plt.show()The result looks like this:ExamplesYou can find example code within the examples folder of this repository. We also wanted to tease the
functionality using two different signals in order to show the capabilities of one of our recommended algorithmsESST. If you want to use the
algorithms on the contents of a CSV directly, there is a frontend demonstrator currently hostedhere(please note that the connection is not ssl-encrypted, the
code for the demonstrator ishere).The first application is a simulated temperature of a component in a power plant during shutdown.
We artificially added a disturbance at the end of the shutdown, to show the capability of the algorithm to
detect a change even in case of another major change.The other application is for anomaly detection within periodic signals. The example is time series
34 from theHexagon ML/UCR Time Series Anomaly Detection dataset, where we
set the window size for the ESST to three times the estimated period in samples (estimated using maximum of FFT).Both plots have been created usingchangepoynt.algorithms.esstand the plot function fromchangepoynt.visualization.score_plotting.InstallationYou can installchangepoyntfrom the common package indexPyPiusing the
following line with pip:pip install changepoyntPlease be aware, that we are currently in an alpha development phase, as this is part of a research project at the FAU
Erlangen together with SIEMENS Energy developed byme. Nevertheless,
we aim to be open-source and try our best to guarantee that all the code we use has very permissive licenses.AlgorithmsWe are actively working on the package. Therefore, some algorithms are already available, while others
are currently under development. An overview with sources can be seen here:AlgorithmSourceStatusSSTIdéStable  :heavy_check_mark:IKA-SSTIdéStable  :heavy_check_mark:RSSTWeberExperimentalRuLSIFLiu et al.Stable  :heavy_check_mark:uLSIFLiu et al.Stable  :heavy_check_mark:KLIEPLiu et al.PlannedClaSPErmshaus et al.Stable :heavy_check_mark:FLUSSGharghabi et al.Stable :heavy_check_mark:FLOSSGharghabi et al.Stable :heavy_check_mark:BOCPDAdams et al.PlannedContributingWe always love to get feedback or new ideas. If you have any of those, feel free to open an issue. We try to get back to
you as soon as we can.If you are an author of a paper in the field or have another algorithmic idea: Feel free to open a pull request.
Currently, we are still working on the contribution guides. But if somebody already comes along and has an idea, we do
not want to be in the way!OutlookWe are actively working on the package, and currently have the following steps planned:We are actively working on a benchmark tool for change point algorithmsImplement Bayesion online change point detectionIf you have further ideas, do not hesitate to open a ticket or a pull request!