{ "info": { "author": "Kit-Ho Mak", "author_email": "kithomak23@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "pytsmp\n======\n\n\n.. image:: https://img.shields.io/pypi/v/pytsmp.svg\n :target: https://pypi.python.org/pypi/pytsmp\n :alt: Latest PyPI version\n\n.. image:: https://codecov.io/gh/kithomak/pytsmp/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/kithomak/pytsmp/branch/master\n :alt: Latest Codecov status\n\n\n.. image:: https://travis-ci.org/kithomak/pytsmp.png\n :target: https://travis-ci.org/kithomak/pytsmp\n :alt: Latest Travis CI build status\n\n\n``pytsmp`` is a Python implementation of the matrix profile. More details about matrix profile can be\nfound in the `UCR Matrix Profile Page `_\nby the paper authors.\n\nCurrently support MASS and the matrix profile algorithms STAMP, STOMP, SCRIMP++ (no multi-core or GPU support yet),\nand some convenience functions such as discords and motifs finding. I plan to implement the parallelized version\nof the matrix profile algorithms later.\n\nThe original implementation (in R) of the paper authors from the UCR group can be found\n`here `_.\n\n\nInstallation\n------------\n\n``pytsmp`` is available via pip.\n\n.. code:: bash\n\n pip install pytsmp\n\n\nUsage\n-----\n\nTo compute the matrix profile using STAMP, use the following code.\n\n.. code:: python\n\n import numpy as np\n from pytsmp import STAMP\n\n # create a 1000 step random walk and a random query\n ts = np.cumsum(np.random.randint(2, size=(1000,)) * 2 - 1)\n query = np.random.rand(200)\n\n # Create the STAMP object. Note that computation starts immediately.\n mp = STAMP(ts, query, window_size=50) # window_size must be specified as a named argument\n\n # get the matrix profile and the profile indexes\n mat_profile, ind_profile = mp.get_profiles()\n\nIncremental of the time series and the query is supported.\n\n.. code:: python\n\n import numpy as np\n from pytsmp import STAMP\n\n # create a 1000 step random walk and its matrix profile\n ts = np.cumsum(np.random.randint(2, size=(1000,)) * 2 - 1)\n mp = STAMP(ts, window_size=50)\n mat_profile, _ = mp.get_profiles()\n\n # create the matrix profile of the first 999 steps and increment the last step later\n mp_inc = STAMP(ts[:-1], window_size=50)\n mp_inc.update_ts1(ts[-1]) # similarly, you can update the query by update_ts2()\n mat_profile_inc, _ = mp_inc.get_profiles()\n\n print(np.allclose(mat_profile, mat_profile_inc)) # True\n\n\nBenchmark\n---------\n\nPerform a simple trial run on a random walk with 40000 data points.\n\n.. code:: python\n\n import numpy as np\n from pytsmp import STAMP\n\n np.random.seed(42) # fix a seed to control randomness\n ts = np.cumsum(np.random.randint(2, size=(40000,)) * 2 - 1)\n\n # ipython magic command\n %timeit mp = STAMP(ts, window_size=1000, verbose=False, seed=42)\n\n # and similarly for STOMP and SCRIMP\n\nOn my MacBook Pro with 2.2 GHz Intel Core i7, the results are (all over 7 runs, 1 loop each):\n\n.. list-table::\n :widths: 25 25 25 25\n :header-rows: 1\n :align: center\n\n * - Algorithm\n - Data Size\n - Window Size\n - Elapsed Time\n * - STAMP\n - 40000\n - 1000\n - 2min 14s \u00b1 392ms\n * - STOMP\n - 40000\n - 1000\n - 22.1s \u00b1 52.8ms\n * - SCRIMP (without PreSCRIMP)\n - 40000\n - 1000\n - 23.6s \u00b1 402ms\n * - PreSCRIMP (Approximate algorithm)\n - 40000\n - 1000\n - 606ms \u00b1 9.5ms\n\n\n\n.. comment\n License\n -------\n\n\nReference\n---------\n\nC.C.M. Yeh, Y. Zhu, L. Ulanova, N. Begum, Y. Ding, H.A. Dau, D. Silva, A. Mueen and E. Keogh.\n\"Matrix profile I: All pairs similarity joins for time series: A unifying view that includes\nmotifs, discords and shapelets\". IEEE ICDM 2016.\n\nY. Zhu, Z. Zimmerman, N.S. Senobari, C.C.M. Yeh, G. Funning, A. Mueen, P. Berisk and E. Keogh.\n\"Matrix Profile II: Exploiting a Novel Algorithm and GPUs to Break the One Hundred Million\nBarrier for Time Series Motifs and Joins\". IEEE ICDM 2016.\n\nY. Zhu, C.C.M. Yeh, Z. Zimmerman, K. Kamgar and E. Keogh.\n\"Matrix Pro\ufb01le XI: SCRIMP++: Time Series Motif Discovery at Interactive Speed\". IEEE ICDM 2018.\n\n\nDisclaimer\n----------\nThis project is for my own learning and understanding purpose, and I may not be able to\nactively develop it from time to time. If you need a Python implementation of the matrix\nprofile, you may try `matrixprofile-ts `_.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kithomak/pytsmp", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytsmp", "package_url": "https://pypi.org/project/pytsmp/", "platform": "", "project_url": "https://pypi.org/project/pytsmp/", "project_urls": { "Homepage": "https://github.com/kithomak/pytsmp" }, "release_url": "https://pypi.org/project/pytsmp/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "A Python implementation of the matrix profile", "version": "0.3.0" }, "last_serial": 5801452, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "082b98006367cc89f59828a8a00bd695", "sha256": "a923c1aed2f4eaa46b5c8aa70c1432b0e14fe7762cc1555b9d0d2c03270c0b90" }, "downloads": -1, "filename": "pytsmp-0.3.0.tar.gz", "has_sig": false, "md5_digest": "082b98006367cc89f59828a8a00bd695", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11129, "upload_time": "2019-09-09T03:04:36", "url": "https://files.pythonhosted.org/packages/ff/95/cdde3543951d3b2ba34a161b54628603a191561f2bc88589e3247800e2a3/pytsmp-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "082b98006367cc89f59828a8a00bd695", "sha256": "a923c1aed2f4eaa46b5c8aa70c1432b0e14fe7762cc1555b9d0d2c03270c0b90" }, "downloads": -1, "filename": "pytsmp-0.3.0.tar.gz", "has_sig": false, "md5_digest": "082b98006367cc89f59828a8a00bd695", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11129, "upload_time": "2019-09-09T03:04:36", "url": "https://files.pythonhosted.org/packages/ff/95/cdde3543951d3b2ba34a161b54628603a191561f2bc88589e3247800e2a3/pytsmp-0.3.0.tar.gz" } ] }