{"id":19140648,"url":"https://github.com/matrix-profile-foundation/tsmp","last_synced_at":"2025-10-07T11:30:35.561Z","repository":{"id":50954212,"uuid":"143645959","full_name":"matrix-profile-foundation/tsmp","owner":"matrix-profile-foundation","description":"R Functions implementing UCR Matrix Profile Algorithm","archived":false,"fork":false,"pushed_at":"2022-08-24T05:18:09.000Z","size":19869,"stargazers_count":71,"open_issues_count":18,"forks_count":18,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-01-17T20:37:59.208Z","etag":null,"topics":["algorithm","matrix-profile","motif-search","r","r-package","time-series"],"latest_commit_sha":null,"homepage":"https://matrix-profile-foundation.github.io/tsmp","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matrix-profile-foundation.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-05T20:37:42.000Z","updated_at":"2024-12-15T19:46:57.000Z","dependencies_parsed_at":"2022-08-21T05:50:57.149Z","dependency_job_id":null,"html_url":"https://github.com/matrix-profile-foundation/tsmp","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-profile-foundation%2Ftsmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-profile-foundation%2Ftsmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-profile-foundation%2Ftsmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-profile-foundation%2Ftsmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matrix-profile-foundation","download_url":"https://codeload.github.com/matrix-profile-foundation/tsmp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235621551,"owners_count":19019519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","matrix-profile","motif-search","r","r-package","time-series"],"created_at":"2024-11-09T07:18:19.256Z","updated_at":"2025-10-07T11:30:30.030Z","avatar_url":"https://github.com/matrix-profile-foundation.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"README\"\nauthor: \"Francisco Bischoff\"\ndate: \"`r format(Sys.Date(), '- %d %b %Y')`\"\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\nlibrary(tsmp)\n```\n\n\u003cimg src=\"man/figures/logo.png\" align=\"right\" style=\"float:right;\" /\u003e\n\n# Time Series with Matrix Profile\n  \u003c!-- badges: start --\u003e\n[![Packagist](https://img.shields.io/badge/License-Apache--2.0-brightgreen.svg)](https://choosealicense.com/licenses/apache-2.0/)\n[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![CRAN version](http://www.r-pkg.org/badges/version/tsmp)](https://cran.r-project.org/package=tsmp)\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/tsmp)](https://cran.r-project.org/package=tsmp)\n[![CircleCI build status](https://circleci.com/gh/matrix-profile-foundation/tsmp.svg?style=svg)](https://app.circleci.com/pipelines/github/matrix-profile-foundation/tsmp)\n  \u003c!-- badges: end --\u003e\n\n|              | Build | Dev |\n|--------------|-------|-----|\n| Windows | [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/byfyqncr60ten98g/branch/master?svg=true)](https://ci.appveyor.com/project/franzbischoff/tsmp/branch/master) | [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/byfyqncr60ten98g/branch/develop?svg=true)](https://ci.appveyor.com/project/franzbischoff/tsmp/branch/develop) |\n| Coverage | [![codecov](https://codecov.io/gh/matrix-profile-foundation/tsmp/branch/master/graph/badge.svg)](https://app.codecov.io/gh/matrix-profile-foundation/tsmp) | [![codecov](https://codecov.io/gh/matrix-profile-foundation/tsmp/branch/develop/graph/badge.svg)](https://app.codecov.io/gh/matrix-profile-foundation/tsmp) |\n\n## Notice\n\nThis version is being maintained to keep up with CRAN standards.\nAs soon as possible a new version (with possible breaking changes) with less dependencies will be released later in 2022 or\nbeginning of 2023.\n\n## Overview\n\nR Functions implementing UCR Matrix Profile Algorithm (http://www.cs.ucr.edu/~eamonn/MatrixProfile.html).\n\nThis package allows you to use the Matrix Profile concept as a toolkit.\n\nThis package provides:\n\n* Algorithms to build a Matrix Profile: STAMP, STOMP, SCRIMP++, SIMPLE, MSTOMP and VALMOD.\n* Algorithms for MOTIF search for Unidimensional and Multidimensional Matrix Profiles.\n* Algorithm for Chains search for Unidimensional Matrix Profile.\n* Algorithms for Semantic Segmentation (FLUSS) and Weakly Labeled data (SDTS).\n* Algorithm for Salient Subsections detection allowing MDS plotting.\n* Basic plotting for all outputs generated here.\n* Sequencial workflow, see below.\n\n```{r basic, examples, eval = FALSE}\n# Basic workflow:\nmatrix \u003c- tsmp(data, window_size = 30) %\u003e%\n  find_motif(n_motifs = 3) %T\u003e%\n  plot()\n\n# SDTS still have a unique way to work:\nmodel \u003c- sdts_train(data, labels, windows)\nresult \u003c- sdts_predict(model, data, round(mean(windows)))\n```\n\nPlease refer to the [User Manual](https://matrixprofile.org/tsmp/reference/) for more details.\n\n\nPlease be welcome to suggest improvements.\n\n### Performance on an Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz using a random walk dataset\n\n```{r bench_data, eval=FALSE, include=TRUE}\nset.seed(2018)\ndata \u003c- cumsum(sample(c(-1, 1), 40000, TRUE))\n```\n\n#### Current version benchmark\n\nWIP in this version\n\n```{r benchmark, eval = FALSE, cache=TRUE, include=FALSE}\nw \u003c- 200\nworkers \u003c- 6\ndata_size \u003c- 5000\nset.seed(2018)\ntimes \u003c- 5L\nmbm_stomp \u003c- round(median(microbenchmark::microbenchmark(tsmp(data, window_size = w, mode = \"stomp\", verbose = 0), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\nmbm_stomp_par \u003c- round(median(microbenchmark::microbenchmark(tsmp(data, window_size = w, mode = \"stomp\", n_workers = workers, verbose = 0), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\nmbm_scrimp \u003c- round(median(microbenchmark::microbenchmark(tsmp(data, window_size = w, mode = \"scrimp\", verbose = 0), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\ntimes \u003c- 10L\nmbm_mpx \u003c- round(median(microbenchmark::microbenchmark(mpx(data, window_size = w), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\nmbm_mpx_par \u003c- round(median(microbenchmark::microbenchmark(mpx(data, window_size = w, n_workers = workers), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\ntimes \u003c- 3L\nmbm_stamp \u003c- round(median(microbenchmark::microbenchmark(tsmp(data, window_size = w, mode = \"stamp\", verbose = 0), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\nmbm_stamp_par \u003c- round(median(microbenchmark::microbenchmark(tsmp(data, window_size = w, mode = \"stamp\", n_workers = workers, verbose = 0), times = times, setup = (data \u003c- cumsum(sample(c(-1, 1), data_size, TRUE))))$time) / 10^9, 2)\n```\n\n```{r bench_dataset, eval = FALSE, echo = FALSE, message=FALSE, warnings=FALSE}\nbench_data \u003c- data.frame(\"Elapsed Time(s)\" = c(mbm_stamp, mbm_stamp_par, mbm_stomp, mbm_stomp_par, mbm_scrimp, mbm_mpx, mbm_mpx_par), \"Data Size\" = data_size, \"Window Size\" = w, Threads = c(1, workers, 1, workers, 1, 1, workers), Lang = c(\"R\", \"R\", \"R\", \"R\", \"R\", \"Rcpp\", \"Rcpp\"), row.names = c(\"`stamp`\", \"`stamp_par`\", \"`stomp`\", \"`stomp_par`\", \"`scrimp`\", \"`mpx`\", \"`mpx_par`\"), check.names = FALSE)\n\nknitr::kable(bench_data[order(bench_data$`Elapsed Time(s)`), ])\n```\n\n## Installation\n\n```{r installation, gh-installation, eval = FALSE}\n# Install the released version from CRAN\ninstall.packages(\"tsmp\")\n\n# Or the development version from GitHub:\n# install.packages(\"devtools\")\ndevtools::install_github(\"matrix-profile-foundation/tsmp\")\n```\n\n## Currently available Features\n\n* STAMP (single and multi-thread versions)\n* STOMP (single and multi-thread versions)\n* STOMPi (On-line version)\n* SCRIMP (single-thread, not for AB-joins yet)\n* Time Series Chains\n* Multivariate STOMP (mSTOMP)\n* Multivariate MOTIF Search (from mSTOMP)\n* Salient Subsequences search for Multidimensional Space\n* Scalable Dictionary learning for Time Series (SDTS) prediction\n* FLUSS (Fast Low-cost Unipotent Semantic Segmentation)\n* FLOSS (Fast Low-cost On-line Unipotent Semantic Segmentation)\n* SiMPle-Fast (Fast Similarity Matrix Profile for Music Analysis and Exploration)\n* Annotation vectors (e.g., Stop-word MOTIF bias, Actionability bias)\n* FLUSS Arc Plot and SiMPle Arc Plot\n* Exact Detection of Variable Length Motifs (VALMOD)\n* MPdist: Matrix Profile Distance\n* Time Series Snippets\n* Subsetting Matrix Profiles (`head()`, `tail()`, `[`, etc.)\n* Misc:\n  * MASS v2.0\n  * MASS v3.0\n  * MASS extensions: ADP (Approximate Distance Profile, with PAA)\n  * MASS extensions: WQ (Weighted Query)\n  * MASS extensions: QwG (Query with Gap)\n  * Fast moving average\n  * Fast moving SD\n\n## Roadmap\n\n* Profile-Based Shapelet Discovery\n* GPU-STOMP\n\n## Other projects with Matrix Profile\n\n* Python: https://github.com/target/matrixprofile-ts\n* Python: https://github.com/ZiyaoWei/pyMatrixProfile\n* Python: https://github.com/juanbeleno/owlpy\n* Python: https://github.com/javidlakha/matrix-profile\n* Python: https://github.com/shapelets/khiva-python\n* R: https://github.com/shapelets/khiva-r\n* Matlab: https://github.com/shapelets/khiva-matlab\n* Java: https://github.com/shapelets/khiva-java\n* Java: https://github.com/ensozos/Matrix-Profile\n* Kotlin: https://github.com/shapelets/khiva-kotlin\n* C++ (CUDA and OPENCL): https://github.com/shapelets/khiva\n* CUDA: https://github.com/zpzim/STOMPSelfJoin\n* CUDA: https://github.com/zpzim/SCAMP\n\n## Matrix Profile Foundation\n\nOur next step unifying the Matrix Profile implementation in several programming languages.\n\nVisit: [Matrix Profile Foundation](https://matrixprofile.org)\n\n## Package dependencies\n\n```{r dependency_plot, echo = FALSE, fig.width = 10, fig.height = 5, message = FALSE, warning = FALSE, fig.path = \"man/figures/\"}\nsource(\"https://gist.githubusercontent.com/franzbischoff/3b83243dfdfa73e459935112f3f783e3/raw/239548243f984843b3a87d8cc82f99395a8ed26e/plot_dependencies.R\")\nplot_dependencies()\n```\n\n## Code of Conduct\n\nPlease note that the 'tsmp' project is released with a\n[Contributor Code of Conduct](https://github.com/matrix-profile-foundation/tsmp/blob/master/.github/CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrix-profile-foundation%2Ftsmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatrix-profile-foundation%2Ftsmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrix-profile-foundation%2Ftsmp/lists"}