Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

STUMPY is a powerful and scalable Python library for modern time series analysis

License

NotificationsYou must be signed in to change notification settings

stumpy-dev/stumpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI VersionConda-Forge VersionPyPI DownloadsLicenseTest StatusCode Coverage

ReadTheDocs StatusBinderJOSSNumFOCUS Affiliated Project


STUMPY Logo

STUMPY

STUMPY is a powerful and scalable Python library that efficiently computes something called thematrix profile, which is just an academic way of saying "for every (green) subsequence within your time series, automatically identify its corresponding nearest-neighbor (grey)":

STUMPY Animated GIF

What's important is that once you've computed your matrix profile (middle panel above) it can then be used for a variety of time series data mining tasks such as:

  • pattern/motif (approximately repeated subsequences within a longer time series) discovery
  • anomaly/novelty (discord) discovery
  • shapelet discovery
  • semantic segmentation
  • streaming (on-line) data
  • fast approximate matrix profiles
  • time series chains (temporally ordered set of subsequence patterns)
  • snippets for summarizing long time series
  • pan matrix profiles for selecting the best subsequence window size(s)
  • and more ...

Whether you are an academic, data scientist, software developer, or time series enthusiast, STUMPY is straightforward to install and our goal is to allow you to get to your time series insights faster. Seedocumentation for more information.

How to use STUMPY

Please see ourAPI documentation for a complete list of available functions and see our informativetutorials for more comprehensive example use cases. Below, you will find code snippets that quickly demonstrate how to use STUMPY.

Typical usage (1-dimensional time series data) withSTUMP:

importstumpyimportnumpyasnpif__name__=="__main__":your_time_series=np.random.rand(10000)window_size=50# Approximately, how many data points might be found in a patternmatrix_profile=stumpy.stump(your_time_series,m=window_size)

Distributed usage for 1-dimensional time series data with Dask Distributed viaSTUMPED:

importstumpyimportnumpyasnpfromdask.distributedimportClientif__name__=="__main__":withClient()asdask_client:your_time_series=np.random.rand(10000)window_size=50# Approximately, how many data points might be found in a patternmatrix_profile=stumpy.stumped(dask_client,your_time_series,m=window_size)

GPU usage for 1-dimensional time series data withGPU-STUMP:

importstumpyimportnumpyasnpfromnumbaimportcudaif__name__=="__main__":your_time_series=np.random.rand(10000)window_size=50# Approximately, how many data points might be found in a patternall_gpu_devices= [device.idfordeviceincuda.list_devices()]# Get a list of all available GPU devicesmatrix_profile=stumpy.gpu_stump(your_time_series,m=window_size,device_id=all_gpu_devices)

Multi-dimensional time series data withMSTUMP:

importstumpyimportnumpyasnpif__name__=="__main__":your_time_series=np.random.rand(3,1000)# Each row represents data from a different dimension while each column represents data from the same dimensionwindow_size=50# Approximately, how many data points might be found in a patternmatrix_profile,matrix_profile_indices=stumpy.mstump(your_time_series,m=window_size)

Distributed multi-dimensional time series data analysis with Dask DistributedMSTUMPED:

importstumpyimportnumpyasnpfromdask.distributedimportClientif__name__=="__main__":withClient()asdask_client:your_time_series=np.random.rand(3,1000)# Each row represents data from a different dimension while each column represents data from the same dimensionwindow_size=50# Approximately, how many data points might be found in a patternmatrix_profile,matrix_profile_indices=stumpy.mstumped(dask_client,your_time_series,m=window_size)

Time Series Chains withAnchored Time Series Chains (ATSC):

importstumpyimportnumpyasnpif__name__=="__main__":your_time_series=np.random.rand(10000)window_size=50# Approximately, how many data points might be found in a patternmatrix_profile=stumpy.stump(your_time_series,m=window_size)left_matrix_profile_index=matrix_profile[:,2]right_matrix_profile_index=matrix_profile[:,3]idx=10# Subsequence index for which to retrieve the anchored time series chain foranchored_chain=stumpy.atsc(left_matrix_profile_index,right_matrix_profile_index,idx)all_chain_set,longest_unanchored_chain=stumpy.allc(left_matrix_profile_index,right_matrix_profile_index)

Semantic Segmentation withFast Low-cost Unipotent Semantic Segmentation (FLUSS):

importstumpyimportnumpyasnpif__name__=="__main__":your_time_series=np.random.rand(10000)window_size=50# Approximately, how many data points might be found in a patternmatrix_profile=stumpy.stump(your_time_series,m=window_size)subseq_len=50correct_arc_curve,regime_locations=stumpy.fluss(matrix_profile[:,1],L=subseq_len,n_regimes=2,excl_factor=1                                                    )

Dependencies

Supported Python and NumPy versions are determined according to theNEP 29 deprecation policy.

Where to get it

Conda install (preferred):

conda install -c conda-forge stumpy

PyPI install, presuming you have numpy, scipy, and numba installed:

python -m pip install stumpy

To install stumpy from source, see the instructions in thedocumentation.

Documentation

In order to fully understand and appreciate the underlying algorithms and applications, it is imperative that you read the originalpublications. For a more detailed example of how to use STUMPY please consult the latestdocumentation or explore ourhands-on tutorials.

Performance

We tested the performance of computing the exact matrix profile using the Numba JIT compiled version of the code on randomly generated time series data with various lengths (i.e.,np.random.rand(n)) along with differentCPU and GPU hardware resources.

STUMPY Performance Plot

The raw results are displayed in the table below as Hours:Minutes:Seconds.Milliseconds and with a constant window size of m = 50. Note that these reported runtimes include the time that it takes to move the data from the host to all of the GPU device(s). You may need to scroll to the right side of the table in order to see all of the runtimes.

in = 2iGPU-STOMPSTUMP.2STUMP.16STUMPED.128STUMPED.256GPU-STUMP.1GPU-STUMP.2GPU-STUMP.DGX1GPU-STUMP.DGX2
66400:00:10.0000:00:00.0000:00:00.0000:00:05.7700:00:06.0800:00:00.0300:00:01.63NaNNaN
712800:00:10.0000:00:00.0000:00:00.0000:00:05.9300:00:07.2900:00:00.0400:00:01.66NaNNaN
825600:00:10.0000:00:00.0000:00:00.0100:00:05.9500:00:07.5900:00:00.0800:00:01.6900:00:06.6800:00:25.68
951200:00:10.0000:00:00.0000:00:00.0200:00:05.9700:00:07.4700:00:00.1300:00:01.6600:00:06.5900:00:27.66
10102400:00:10.0000:00:00.0200:00:00.0400:00:05.6900:00:07.6400:00:00.2400:00:01.7200:00:06.7000:00:30.49
112048NaN00:00:00.0500:00:00.0900:00:05.6000:00:07.8300:00:00.5300:00:01.8800:00:06.8700:00:31.09
124096NaN00:00:00.2200:00:00.1900:00:06.2600:00:07.9000:00:01.0400:00:02.1900:00:06.9100:00:33.93
138192NaN00:00:00.5000:00:00.4100:00:06.2900:00:07.7300:00:01.9700:00:02.4900:00:06.6100:00:33.81
1416384NaN00:00:01.7900:00:00.9900:00:06.2400:00:08.1800:00:03.6900:00:03.2900:00:07.3600:00:35.23
1532768NaN00:00:06.1700:00:02.3900:00:06.4800:00:08.2900:00:07.4500:00:04.9300:00:07.0200:00:36.09
1665536NaN00:00:22.9400:00:06.4200:00:07.3300:00:09.0100:00:14.8900:00:08.1200:00:08.1000:00:36.54
1713107200:00:10.0000:01:29.2700:00:19.5200:00:09.7500:00:10.5300:00:29.9700:00:15.4200:00:09.4500:00:37.33
1826214400:00:18.0000:05:56.5000:01:08.4400:00:33.3800:00:24.0700:00:59.6200:00:27.4100:00:13.1800:00:39.30
1952428800:00:46.0000:25:34.5800:03:56.8200:01:35.2700:03:43.6600:01:56.6700:00:54.0500:00:19.6500:00:41.45
20104857600:02:30.0001:51:13.4300:19:54.7500:04:37.1500:03:01.1600:05:06.4800:02:24.7300:00:32.9500:00:46.14
21209715200:09:15.0009:25:47.6403:05:07.6400:13:36.5100:08:47.4700:20:27.9400:09:41.4300:01:06.5100:01:02.67
224194304NaN36:12:23.7410:37:51.2100:55:44.4300:32:06.7001:21:12.3300:38:30.8600:04:03.2600:02:23.47
238388608NaN143:16:09.9438:42:51.4203:33:30.5302:00:49.3705:11:44.4502:33:14.6000:15:46.2600:08:03.76
2416777216NaNNaNNaN14:39:11.9907:13:47.1220:43:03.8009:48:43.4201:00:24.0600:29:07.84
NaN1772980009:16:12.00NaNNaN15:31:31.7507:18:42.5423:09:22.4310:54:08.6401:07:35.3900:32:51.55
2533554432NaNNaNNaN56:03:46.8126:27:41.2983:29:21.0639:17:43.8203:59:32.7901:54:56.52
2667108864NaNNaNNaN211:17:37.60106:40:17.17328:58:04.68157:18:30.5015:42:15.9407:18:52.91
NaN100000000291:07:12.00NaNNaNNaN234:51:35.39NaNNaN35:03:44.6116:22:40.81
27134217728NaNNaNNaNNaNNaNNaNNaN64:41:55.0929:13:48.12

Hardware Resources

GPU-STOMP: These results are reproduced from the originalMatrix Profile II paper - NVIDIA Tesla K80 (contains 2 GPUs) and serves as the performance benchmark to compare against.

STUMP.2:stumpy.stump executed with 2 CPUs in Total - 2x Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz processors parallelized with Numba on a single server without Dask.

STUMP.16:stumpy.stump executed with 16 CPUs in Total - 16x Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz processors parallelized with Numba on a single server without Dask.

STUMPED.128:stumpy.stumped executed with 128 CPUs in Total - 8x Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz processors x 16 servers, parallelized with Numba, and distributed with Dask Distributed.

STUMPED.256:stumpy.stumped executed with 256 CPUs in Total - 8x Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz processors x 32 servers, parallelized with Numba, and distributed with Dask Distributed.

GPU-STUMP.1:stumpy.gpu_stump executed with 1x NVIDIA GeForce GTX 1080 Ti GPU, 512 threads per block, 200W power limit, compiled to CUDA with Numba, and parallelized with Python multiprocessing

GPU-STUMP.2:stumpy.gpu_stump executed with 2x NVIDIA GeForce GTX 1080 Ti GPU, 512 threads per block, 200W power limit, compiled to CUDA with Numba, and parallelized with Python multiprocessing

GPU-STUMP.DGX1:stumpy.gpu_stump executed with 8x NVIDIA Tesla V100, 512 threads per block, compiled to CUDA with Numba, and parallelized with Python multiprocessing

GPU-STUMP.DGX2:stumpy.gpu_stump executed with 16x NVIDIA Tesla V100, 512 threads per block, compiled to CUDA with Numba, and parallelized with Python multiprocessing

Running Tests

Tests are written in thetests directory and processed usingPyTest and requirescoverage.py for code coverage analysis. Tests can be executed with:

./test.sh

Python Version

STUMPY supportsPython 3.9+ and, due to the use of unicode variable names/identifiers, is not compatible with Python 2.x. Given the small dependencies, STUMPY may work on older versions of Python but this is beyond the scope of our support and we strongly recommend that you upgrade to the most recent version of Python.

Getting Help

First, please check thediscussions andissues on Github to see if your question has already been answered there. If no solution is available there feel free to open a new discussion or issue and the authors will attempt to respond in a reasonably timely fashion.

Contributing

We welcomecontributions in any form! Assistance with documentation, particularly expanding tutorials, is always welcome. To contribute pleasefork the project, make your changes, and submit a pull request. We will do our best to work through any issues with you and get your code merged into the main branch.

Citing

If you have used this codebase in a scientific publication and wish to cite it, please use theJournal of Open Source Software article.

S.M. Law, (2019).STUMPY: A Powerful and Scalable Python Library for Time Series Data Mining. Journal of Open Source Software, 4(39), 1504.
@article{law2019stumpy,author  ={Law, Sean M.},title   ={{STUMPY: A Powerful and Scalable Python Library for Time Series Data Mining}},journal ={{The Journal of Open Source Software}},volume  ={4},number  ={39},pages   ={1504},year    ={2019}}

References

Yeh, Chin-Chia Michael, et al. (2016) Matrix Profile I: All Pairs Similarity Joins for Time Series: A Unifying View that Includes Motifs, Discords, and Shapelets. ICDM:1317-1322.Link

Zhu, Yan, et al. (2016) Matrix Profile II: Exploiting a Novel Algorithm and GPUs to Break the One Hundred Million Barrier for Time Series Motifs and Joins. ICDM:739-748.Link

Yeh, Chin-Chia Michael, et al. (2017) Matrix Profile VI: Meaningful Multidimensional Motif Discovery. ICDM:565-574.Link

Zhu, Yan, et al. (2017) Matrix Profile VII: Time Series Chains: A New Primitive for Time Series Data Mining. ICDM:695-704.Link

Gharghabi, Shaghayegh, et al. (2017) Matrix Profile VIII: Domain Agnostic Online Semantic Segmentation at Superhuman Performance Levels. ICDM:117-126.Link

Zhu, Yan, et al. (2017) Exploiting a Novel Algorithm and GPUs to Break the Ten Quadrillion Pairwise Comparisons Barrier for Time Series Motifs and Joins. KAIS:203-236.Link

Zhu, Yan, et al. (2018) Matrix Profile XI: SCRIMP++: Time Series Motif Discovery at Interactive Speeds. ICDM:837-846.Link

Yeh, Chin-Chia Michael, et al. (2018) Time Series Joins, Motifs, Discords and Shapelets: a Unifying View that Exploits the Matrix Profile. Data Min Knowl Disc:83-123.Link

Gharghabi, Shaghayegh, et al. (2018) "Matrix Profile XII: MPdist: A Novel Time Series Distance Measure to Allow Data Mining in More Challenging Scenarios." ICDM:965-970.Link

Zimmerman, Zachary, et al. (2019) Matrix Profile XIV: Scaling Time Series Motif Discovery with GPUs to Break a Quintillion Pairwise Comparisons a Day and Beyond. SoCC '19:74-86.Link

Akbarinia, Reza, and Betrand Cloez. (2019) Efficient Matrix Profile Computation Using Different Distance Functions. arXiv:1901.05708.Link

Kamgar, Kaveh, et al. (2019) Matrix Profile XV: Exploiting Time Series Consensus Motifs to Find Structure in Time Series Sets. ICDM:1156-1161.Link

License & Trademark

STUMPY
Copyright 2019 TD Ameritrade. Released under the terms of the 3-Clause BSD license.
STUMPY is a trademark of TD Ameritrade IP Company, Inc. All rights reserved.

[8]ページ先頭

©2009-2025 Movatter.jp