Time Series with Matrix Profile

A toolkit implementing the Matrix Profile concept that was created by CS-UCR < http://www.cs.ucr.edu/~eamonn/MatrixProfile.html>.


Francisco Bischoff - 23 Feb 2019

Packagist lifecycle CRANversion CRANDownloads

Build Dev
Linux x86_64 Build Status Build Status
OSX Build Status Build Status
Windows AppVeyor build status AppVeyor build status
Coverage codecov codecov


R Functions implementing UCR Matrix Profile Algorithm (http://www.cs.ucr.edu/~eamonn/MatrixProfile.html).

This package allows you to use the Matrix Profile concept as a toolkit.

This package provides:

  • Algorithms to build a Matrix Profile: STAMP, STOMP, SCRIMP++, SIMPLE, MSTOMP and VALMOD.
  • Algorithms for MOTIF search for Unidimensional and Multidimensional Matrix Profiles.
  • Algorithm for Chains search for Unidimensional Matrix Profile.
  • Algorithms for Semantic Segmentation (FLUSS) and Weakly Labeled data (SDTS).
  • Algorithm for Salient Subsections detection allowing MDS plotting.
  • Basic plotting for all outputs generated here.
  • Sequencial workflow, see below.
# Basic workflow:
matrix <- tsmp(data, window_size = 30) %>% find_motif(n_motifs = 3) %>% plot()
# SDTS still have a unique way to work:
model <- sdts_train(data, labels, windows)
result <- sdts_predict(model, data, round(mean(windows)))

Please refer to the User Manual for more details.

Please be welcome to suggest improvements.

Performance on an Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz using a random walk dataset

data <- cumsum(sample(c(-1, 1), 40000, TRUE))
Elapsed Time Data size Window size Threads
stomp_par() 52.72s 40000 1000 8
scrimp() 92.44s 40000 1000 1
stomp() 136.01s 40000 1000 1
stamp_par() 140.25s 40000 1000 8
stamp() 262.03s 40000 1000 1


# Install the released version from CRAN
# Or the development version from GitHub:
# install.packages("devtools")

Currently available Features

  • STAMP (single and multi-thread versions)
  • STOMP (single and multi-thread versions)
  • SCRIMP (single-thread, not for AB-joins yet)
  • Time Series Chains
  • Multivariate STOMP (mSTOMP)
  • Multivariate MOTIF Search (from mSTOMP)
  • Salient Subsequences search for Multidimensional Space
  • Scalable Dictionary learning for Time Series (SDTS) prediction
  • FLUSS (Fast Low-cost Unipotent Semantic Segmentation)
  • SiMPle-Fast (Fast Similarity Matrix Profile for Music Analysis and Exploration)
  • Annotation vectors (e.g., Stop-word MOTIF bias, Actionability bias)
  • FLUSS Arc Plot and SiMPle Arc Plot
  • Exact Detection of Variable Length Motifs (VALMOD)
  • Misc:
    • MASS v2.0
    • Fast moving average
    • Fast moving SD


  • Profile-Based Shapelet Discovery
  • Real-time version of previous algorithms (STAMPI, FLOSS, etc.)
  • MASS Extensions (ADP, WQ, QwG)

Other projects with Matrix Profile

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms.



Francisco Bischoff - 23 Feb 2019

tsmp 0.3.4

  • Added find_discord() and its print() and plot() functions.
  • Changed plot() for motifs to show where are the neighbors. Same for discord.
  • Added valmod() for Variable Length Motif Discovery.
  • Changed find_motif() for compatibility with valmod().

tsmp 0.3.3

  • Fixed find_chains() not returning the longest chain. Issue #33

tsmp 0.3.2

  • Fixed Matrix Profile print, dimensions are now reported correctly.
  • Fixed pipe imports. Issue #22
  • Fixed bug with vars. Issue #23
  • Changed package license to GPL-3.
  • Changed verbose mode, added one more step to separate messages from progression bar.
  • Fixed SCRIMP and added PRE-SCRIMP, so this is the SCRIMP++. AB-join not yet implemented.
  • Changed progress bar for a better one from progress package.
  • Added Print and Plot to SiMPle. Issue #24
  • Added Print and Plot to Salient.

tsmp 0.3.1


  • This version is a complete restructuration. The API has changed, and the workflow is more friendly. This API is intended to be stable, and from now on any change will pass through the “Deprecated” stage.

Added Features

  • Outputs have a prettier print format.
  • Outputs have a plot function. Try to plot a tsmp() output for example.
  • Now functions can work in %>% (pipe), e.g. tsmp() %>% find_motif(). Except for SDTS that has a proper way to work.
  • Added a wrapper function called tsmp() that handles the several algorithms available.
  • Added as.* functions to allow you to switch classes if you want, e.g.: as.matrixprofile().
  • Changed all functions from dotted.case to snake_case (except as.* functions).
  • Added Annotation Vectors.
  • Fixed STOMP crash with Joins.
  • Added support to query < data in Joins.
  • SCRIMP (experimental).

tsmp 0.2.15

  • Code linting.
  • Added Salient Subsequences search.

tsmp 0.2.14

  • Added SiMPle (Fast Similarity Matrix Profile for Music Analysis and Exploration).
  • Added FLUSS (Fast Low-cost Unipotent Semantic Segmentation).
  • Added [find_chains()] to look for chains primitives.
  • Added Multivariate MOTIF Search (from mSTOMP)
  • Changed dependency from beepr to audio (actually beepr depends on audio, so fewer dependencies).
  • Added a NEWS.md file to track changes to the package.

tsmp 0.2.12

  • Added Multivariate STOMP parallel version.
  • Added SDTS algorithm (Scalable Dictionary learning for Time Series).

tsmp 0.1.0

  • STAMP and STAMP parallel Algorithm.
  • Multivariate STOMP algorithm.
  • MASS algorithm.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.5 by Francisco Bischoff, 5 months ago


Report a bug at https://github.com/franzbischoff/tsmp/issues

Browse source code at https://github.com/cran/tsmp

Authors: Francisco Bischoff [aut, cre] , Michael Yeh [res, ccp, ctb] , Diego Silva [res, ccp, ctb] , Yan Zhu [res, ccp, ctb] , Hoang Dau [res, ccp, ctb] , Michele Linardi [res, ccp, ctb]

Documentation:   PDF Manual  

GPL-3 license

Imports audio, doSNOW, parallel, foreach, progress, magrittr

Suggests spelling, testthat, knitr, rmarkdown, gdtools, vdiffr, animation

See at CRAN