MATRIX PROFILE EXPLORER · TIME SERIES MOTIFS AND ANOMALIES · RUNS IN YOUR BROWSER · NOTHING UPLOADED

Find repeated patterns and anomalies in a time series

Paste or upload a time series. This tool computes its matrix profile, exactly, with the STOMP algorithm, and tells you which stretches repeat (motifs: the most similar pairs of subsequences) and which stretch is unlike anything else (discords: the best-known definition of a time series anomaly). It needs no labels, no training and no model of what normal looks like.

Nothing you enter leaves this browser tab. A statistical description of the data you supply, not advice. Not legal, tax, or financial advice.

Your time series

The window is the length of the pattern you are looking for, in rows: 12 for a yearly cycle in monthly data, 24 for a daily cycle in hourly data. Leave it blank to have one suggested from the strongest cycle in the data. Empty or non-numeric cells inside the column are filled by straight-line interpolation and reported.

Paste a series or load the example, then click Find motifs and anomalies.

Method and citation

Matrix profile. For a series of n points and a window of m points there are n − m + 1 subsequences. Each is z-normalized (mean 0, population standard deviation 1) and compared with every other by Euclidean distance. The matrix profile P[i] is the distance from subsequence i to its nearest neighbour, and the matrix profile index I[i] is where that neighbour starts (Yeh et al. 2016). The distance runs from 0 (same shape) to 2√m (opposite shape) and equals √(2m(1 − r)) for Pearson correlation r, which is why the tables also show r.

Exclusion zone. A window's neighbour must start more than ⌈m/4⌉ points away, so that it is not matched with a copy of itself shifted by one or two points (a trivial match). Paper I used m/2; m/4 is the value used in Paper II and common libraries. When listing the top motifs and discords, a result is skipped if it starts within m points of one already listed, so the listed ones do not overlap; the two members of a motif pair only need to be more than ⌈m/4⌉ apart.

Algorithm. STOMP (Zhu et al. 2016): the dot products of the first window with every other are computed directly, then each next row from the previous one with the O(1) update QT[i][j] = QT[i−1][j−1] − T[i−1]T[j−1] + T[i+m−1]T[j+m−1], and each distance from its dot product and the two windows' mean and standard deviation. Total time is O(n²), exact, not approximate. Only pairs with j > i are evaluated, and each updates both P[i] and P[j]. The series is centred first and window statistics are computed in two passes, for accuracy. It runs in a background worker when your browser allows it.

Flat windows. A window whose values are all identical has no z-normalized shape. It is treated as all zeros: two flat windows are at distance 0, and a flat window and any other are at distance √m. No NaN is produced.

Suggested window. When you leave the window blank: remove the least-squares quadratic trend, compute the autocorrelation for lags 3 to min(n/4, 1000), and take the first local peak after it first drops below zero, if that peak is at least 0.2. That is one period of the strongest cycle. Otherwise the window is n/50, kept between 8 and 100.

Checked against a brute-force O(n²m) implementation that z-normalizes every window explicitly, on seeded random series, and against the output of the open-source STUMPY library (version 1.14.1) on the Mauna Loa series, a random walk and a series with flat stretches: largest difference below 10−10. Planted motifs and planted anomalies are found at the planted positions.

Please cite the papers if you use these results. Further reading: the UCR Matrix Profile page by Eamonn Keogh's group, with the papers, data and many more uses of the matrix profile.

@inproceedings{yeh2016matrixprofile1,
  author    = {Yeh, Chin-Chia Michael and Zhu, Yan and Ulanova, Liudmila and Begum, Nurjahan and Ding, Yifei and Dau, Hoang Anh and Silva, Diego Furtado and Mueen, Abdullah and Keogh, Eamonn},
  title     = {Matrix Profile I: All Pairs Similarity Joins for Time Series: A Unifying View That Includes Motifs, Discords and Shapelets},
  booktitle = {2016 IEEE 16th International Conference on Data Mining (ICDM)},
  pages     = {1317--1322},
  year      = {2016},
  doi       = {10.1109/ICDM.2016.0179}
}

@inproceedings{zhu2016matrixprofile2,
  author    = {Zhu, Yan and Zimmerman, Zachary and Senobari, Nader Shakibay and Yeh, Chin-Chia Michael and Funning, Gareth and Mueen, Abdullah and Brisk, Philip and Keogh, Eamonn},
  title     = {Matrix Profile II: Exploiting a Novel Algorithm and GPUs to Break the One Hundred Million Barrier for Time Series Motifs and Joins},
  booktitle = {2016 IEEE 16th International Conference on Data Mining (ICDM)},
  pages     = {739--748},
  year      = {2016},
  doi       = {10.1109/ICDM.2016.0085}
}

Implemented from the papers' definitions; no code was copied from any matrix profile library.

Limits

Example data

The example is the monthly mean atmospheric CO2 at Mauna Loa Observatory, Hawaii, from March 1958 to September 2026 (823 months, ppm), from the NOAA Global Monitoring Laboratory. Data from March 1958 to April 1974 were obtained by C. David Keeling of the Scripps Institution of Oceanography. Measurements were made at Maunakea, about 21 miles north, from December 2022 to July 4, 2023 after the Mauna Loa eruption. Credit: Dr. Xin Lan, NOAA/GML (gml.noaa.gov/ccgg/trends/) and Dr. Ralph Keeling, Scripps Institution of Oceanography (scrippsco2.ucsd.edu). Retrieved 2026-10-20. A US government work; NOAA asks that it be cited.

With the suggested 12-month window, the top motif is the pair of 12-month stretches starting September 2014 and September 2024: the seasonal cycle repeats with correlation 0.999. The top discord is the 12 months starting January 2024, the stretch whose shape is least like any other 12-month stretch in the record (its nearest match, starting January 2005, still correlates 0.977; the typical nearest-match distance is less than half as large). The matrix profile says the shape is unusual, not why.

Common questions

What is a matrix profile?

Slide a window of m points along your series. For every window, find the most similar window elsewhere in the series, comparing shape only. The matrix profile is the list of those nearest-neighbour distances, one per window, and the matrix profile index says where each nearest neighbour is. Low values mark patterns that repeat; high values mark stretches unlike anything else. It was introduced by Yeh, Keogh and colleagues in 2016.

How do I find repeated patterns in a time series?

Look for the lowest points of the matrix profile. The window with the smallest nearest-neighbour distance, together with that neighbour, is the top motif: the two stretches of your series with the most similar shape. This tool lists the top motifs, marks them on the chart and gives each pair's correlation, so 0.99 means almost the same shape.

How does the matrix profile detect anomalies in a time series?

An anomaly, or discord, is a stretch whose nearest neighbour is far away: nothing else in the series looks like it. The highest points of the matrix profile are the discords. Unlike a threshold on the values, this catches unusual shapes even when every value is within the normal range, and it needs no training data or labels.

How do I choose the window length?

Use the length of the pattern you care about: 12 for a yearly cycle in monthly data, 24 or 168 for a daily or weekly cycle in hourly data, one heartbeat for an ECG. If you leave it blank, the tool removes a quadratic trend, finds the first clear peak of the autocorrelation and uses that period. Results can change a lot with the window, so try a few.

Why does the matrix profile ignore the level of my data?

Each window is z-normalized, shifted to mean zero and scaled to unit spread, before it is compared. That makes the comparison about shape, so a seasonal cycle at 320 ppm matches the same cycle at 420 ppm. The flip side is that a window that is only unusually high or low, with an ordinary shape, is not a discord. Look at the raw values for level shifts.

How long a time series can I analyse in the browser?

The exact matrix profile compares every window with every other, so time grows with the square of the length. About 20,000 points takes one to three seconds on a typical laptop; 100,000 takes about 25 times as long. Above 200,000 points the tool refuses; downsample or analyse a shorter stretch.

Is my time series uploaded anywhere?

No. The file is read and analysed inside this browser tab, in a background worker when your browser supports it. There are no accounts, cookies or analytics vendors.

Also available from the command line (node cli.mjs series.csv --window 12 --json) and to AI agents through the repository's tool server. Source on GitHub.