- Notifications
You must be signed in to change notification settings - Fork19
This repository contains the time series segmentation benchmark (TSSB).
License
ermshaua/time-series-segmentation-benchmark
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The problem of time series segmentation (TSS) is to find a meaningful segmentation of a time series (TS) that captures a data-generating process with distinct states and transitions. We consider a segmentation meaningful, if the change points (CPs) between two consecutive segments correspond to state transitions in the associated process.
This repository contains the time series segmentation benchmark (TSSB). It currently contains 75 annotated TS with 1-9 segments. Each TS is constructed from one of theUEA & UCR time series classification datasets. We group TS by label and concatenate them to create segments with distinctive temporal patterns and statistical properties. We annotate the offsets at which we concatenated the segments as CPs. Addtionally, we apply resampling to control the dataset resolution and add approximate, hand-selected window sizes that are able to capture temporal patterns. We have ajupyter notebook that shows how to automatically perform the transformation.
You can install the TSSB with PyPi:python -m pip install git+https://github.com/ermshaua/time-series-segmentation-benchmark
If you use the TSSB in your scientific publication, we would appreciate the following citations:
@article{clasp2023, title={ClaSP: parameter-free time series segmentation}, author={Arik Ermshaus and Patrick Sch{\"a}fer and Ulf Leser}, journal={Data Mining and Knowledge Discovery}, year={2023},}@inproceedings{clasp2021, title={ClaSP - Time Series Segmentation}, author={Sch{\"a}fer, Patrick and Ermshaus, Arik and Leser, Ulf}, booktitle={CIKM}, year={2021}}We have evaluated 7 time series segmentation algorithms using the TSSB. The following table summarises the average segmentation Covering (higher is better) and the corresponding mean ranks. Evaluation details are in thepaper. The raw result sheet and an evaluation notebook are in thenotebooks folder.
| Segmentation Algorithm | Mean Accuracy | Mean Rank | Wins & Ties |
|---|---|---|---|
| ClaSP | 85.47% | 1.5 | 54/75 |
| BinSeg | 57.49% | 2.8 | 12/75 |
| PELT | 58.1% | 2.9 | 12/75 |
| FLOSS | 56.74% | 3.1 | 12/75 |
| Window | 40.1% | 4.3 | 7/75 |
| BOCD | 44.88% | 4.3 | 6/75 |
| ESPRESSO | 44.36% | 4.6 | 4/75 |
The mean ranks are visualized in the followind critical difference (CD) diagram. Not significantly different algorithms are connected with a horizontal bar basedon a Nemenyi two tailed significance test with a = 0.05. The boxplot illustrates the summary statistics.
Let's first import methods to load TS from the benchmark and to evaluate TSS algorithms. As an example, we also import our segmentation algorithm ClaSP fromclaspy.
>>>fromtssb.utilsimportload_time_series_segmentation_datasets>>>fromtssb.evaluationimportcovering>>>fromclaspy.segmentationimportBinaryClaSPSegmentation
We can now load the entire benchmark (75 TS) as a pandas dataframe using
>>>tssb=load_time_series_segmentation_datasets()
or a selection of TS by specifying thenames attribute using
>>>tssb=load_time_series_segmentation_datasets(names=["ArrowHead","InlineSkate","Plane"])
The dataframetssb contains (TS name, window size, CPs, TS) rows and can now be iterated to evaluate a TSS algorithm.
>>>for_, (ts_name,window_size,cps,ts)intssb.iterrows():>>>found_cps=BinaryClaSPSegmentation().fit_predict(ts)>>>score=covering({0:cps},found_cps,ts.shape[0])>>>print(f"Time Series:{ts_name}: True Change Points:{cps}, Found Change Points:{found_cps.tolist()}, Score:{score}")
In a similar fashion, you can evaluate your TSS algorithm and compare results. For more details, see the examplenotebooks.
See the following example TS to get an overview of the TSSB. You can find more images in thevisualizations folder.
In order to create a visualization of your predicted segmentation, you can use the following code.
>>>importmatplotlib.pyplotasplt>>>fromtssb.utilsimportvisualize_time_series>>>fig,ax=visualize_time_series(ts,ts_name,cps,found_cps)>>>plt.show()
About
This repository contains the time series segmentation benchmark (TSSB).
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.





