saxpy — SAX and the algorithms built on it, in Python
saxpy is the Python reference implementation of the jMotif SAX stack, released under GPL v2.0. It implements:
- Symbolic Aggregate approXimation (SAX): discretizing a time series into a string, with z-normalization and PAA [1]
- HOT-SAX: exact time series discord (anomaly) discovery [3]
- RePair: grammar inference over the SAX representation [7]
- RRA (Rare Rule Anomaly): grammar-based, variable-length discord discovery built on RePair [8]
- SAX-VSM: interpretable time series classification, with discretization parameter optimization [5]
- SAX-ENERGY, SAX-REPEAT, SAX-INDEPENDENT: SAX for multi-dimensional time series [4]
saxpy favours readable code and agreement with the R and Java implementations over speed. Use it
to read the algorithms, run experiments in Python, or reproduce results;
jmotif-conformance generates its golden
expectations from saxpy and checks R and Java against them. For large series or production
throughput, use the compiled R (jmotif) or Java (jmotif-sax, jmotif-gi, GrammarViz) packages.
Also in: Java (SAX) · R (jmotif) — related: GI, SAX-VSM, GrammarViz, conformance tests
Install
saxpy requires Python 3.10+; pip pulls in its dependencies (numpy, scipy,
scikit-learn). To work on saxpy itself (tests, patches, the SAX-VSM examples that need the
bundled CBF files), clone the repository and follow Development from source.
The system Python on current macOS (Homebrew) and Debian/Ubuntu is
externally managed, so a bare pip install fails there.
Install into a virtual environment:
python3 -m venv ~/venvs/saxpy
source ~/venvs/saxpy/bin/activate # Windows: ~/venvs/saxpy\Scripts\activate
python -m pip install -U pip
pip install saxpy
python -c "import saxpy; print(saxpy.__version__)"
With uv, create and activate the venv the same way (or with
uv venv), then run uv pip install saxpy; uv also refuses to install outside a virtual
environment.
The wheel includes the ecg0606 ECG sample (ecg0606_path()). The UCR
Cylinder-Bell-Funnel files used in the SAX-VSM examples (§7) are only in the repository,
under resources/data/cbf/.
Quick start
With the venv activated, run in Python:
import numpy as np
from saxpy import ecg0606_path, find_discords_hotsax, find_discords_rra
ecg = np.genfromtxt(ecg0606_path(), delimiter=",")
hotsax = find_discords_hotsax(
ecg, win_size=100, num_discords=2, paa_size=4, alphabet_size=4
)
rra = find_discords_rra(
ecg, win_size=100, paa_size=4, alphabet_size=4,
num_discords=1, random_state=0,
)
print("ecg length:", len(ecg)) # 2299
print("HOT-SAX top discord:", hotsax[0][0]) # 430 on ecg0606
print("RRA spans:", len(rra)) # 1
The examples below (§1–§7) mostly import from submodules (from saxpy.znorm import znorm).
Both styles work, except for the two names in the next section.
Import cheat sheet
Most functions are re-exported from the top-level package (from saxpy import …). Two
names, znorm and paa, are also submodule names, so from saxpy import znorm
returns the module; import those two from their modules:
| Task | Import |
|---|---|
| Sample ECG path | from saxpy import ecg0606_path |
| z-normalization | from saxpy.znorm import znorm |
| PAA | from saxpy.paa import paa |
| SAX string / sliding window | from saxpy.sax import ts_to_string, sax_by_chunking, sax_via_window |
| Alphabet breakpoints | from saxpy.alphabet import cuts_for_asize |
| HOT-SAX / brute-force discords | from saxpy import find_discords_hotsax, find_discords_brute_force |
| RePair grammar | from saxpy.repair import str_to_repair_grammar |
| RRA discords | from saxpy import find_discords_rra |
| SAX-VSM classify | from saxpy.saxvsm import load_ucr_data, train_tfidf, classify_series, classification_accuracy |
| SAX-VSM bags / TF·IDF | from saxpy.saxvsm import series_to_wordbag, manyseries_to_wordbag, bags_to_tfidf, cosine_distance |
| DIRECT parameter search | from saxpy.saxvsm_optimize import optimize_parameters, cv_error |
Attribute access (import saxpy, then saxpy.find_discords_hotsax) works for every row
except znorm and paa.
Development from source
The project uses uv for environments and packaging
(PEP 621 pyproject.toml, Hatchling build backend). From a clone:
$ uv sync # create .venv and install saxpy + dev tools
$ uv run pytest # run the test suite (unit tests + doctests)
$ uv run ruff check # lint
$ uv run ruff format # format
$ uv run mypy saxpy # type-check
uv run --python 3.10 pytest (or 3.11, 3.12) runs the tests on another supported interpreter;
uv build writes a wheel and an sdist to dist/; uv run pre-commit install enables the
ruff and mypy hooks.
SAX in a nutshell
SAX transforms a sequence of rational numbers (a time series) into a sequence of letters (a string). Here a 128-point time series is converted into an 8-letter word:
More about SAX: SAX overview by Jessica Lin, Eamonn Keogh's SAX page, and the SAX-VSM site's SAX page.
1.0 Simple time series to SAX conversion
Converting a time series of any length to SAX starts with the alphabet cuts. cuts_for_asize
returns the cuts for a normal alphabet, here of size 3:
from saxpy.alphabet import cuts_for_asize
cuts_for_asize(3)
The leading -inf is the lower sentinel, so the array has alphabet_size entries:
array([ -inf, -0.4307273, 0.4307273])
ts_to_string converts a z-normalized series to letters:
import numpy as np
from saxpy.znorm import znorm
from saxpy.sax import ts_to_string
ts_to_string(znorm(np.array([-2, 0, 2, 0, -1])), cuts_for_asize(3))
which produces:
'abcba'
2.0 SAX conversion with PAA aggregation (i.e., "chunking")
PAA (Piecewise Aggregate Approximation) is usually applied before SAX to reduce dimensionality further. PAA splits the series into equal-sized segments and averages each one, so the example above shrinks from five points to three letters:
import numpy as np
from saxpy.znorm import znorm
from saxpy.paa import paa
from saxpy.sax import ts_to_string
from saxpy.alphabet import cuts_for_asize
dat = np.array([-2, 0, 2, 0, -1])
dat_paa_3 = paa(znorm(dat), 3)
ts_to_string(dat_paa_3, cuts_for_asize(3))
which produces:
'acb'
sax_by_chunking(series, paa_size, alphabet_size=3, znorm_threshold=0.01) z-normalizes,
PAA-reduces, and discretizes in one call:
from saxpy.sax import sax_by_chunking
sax_by_chunking(np.array([-2., 0, 2, 0, -1, 1, 3, 1, 0]), paa_size=3, alphabet_size=3)
# 'bbc'
3.0 SAX conversion via a sliding window
To find anomalous (discord) and recurrent (motif) patterns, a time series is usually converted
to SAX with a sliding window. sax_via_window implements this:
import numpy as np
from saxpy.sax import sax_via_window
dat = np.array([0., 0., 0., 0., 0., -0.270340178359072, -0.367828308500142,
0.666980581124872, 1.87088147328446, 2.14548907684624,
-0.480859313143032, -0.72911654245842, -0.490308602315934,
-0.66152028906509, -0.221049033806403, 0.367003418871239,
0.631073992586373, 0.0487728723414486, 0.762655178750436,
0.78574757843331, 0.338239686422963, 0.784206454089066,
-2.14265084073625, 2.11325193044223, 0.186018356196443,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.519132472499234,
-2.604783141655, -0.244519550114012, -1.6570790528784,
3.34184602886343, 2.10361226260999, 1.9796808733979,
-0.822247322003058, 1.06850578033292, -0.678811824405992,
0.804225748913681, 0.57363964388698, 0.437113583759113,
0.437208643628268, 0.989892093383503, 1.76545983424176,
0.119483882364649, -0.222311941138971, -0.74669456611669,
-0.0663660879732063, 0., 0., 0., 0., 0.,])
sax_via_window(dat, win_size=6, paa_size=3, alphabet_size=3, nr_strategy=None, znorm_threshold=0.01)
The result maps each SAX word to the start positions where it occurs, in order of first occurrence (as IPython or Jupyter displays it):
defaultdict(list,
{'cca': [0, 1],
'bbc': [2],
'bac': [3, 19, 34, 45, 51],
'aac': [4, 10, 11, 30, 35],
'acb': [5, 16, 21, 37, 43],
'bca': [6, 17, 32, 38, 47, 48],
'cba': [7, 39, 49],
'caa': [8, 23, 24, 40],
'cab': [9, 50],
'abc': [12, 14, 36, 44],
'acc': [13, 52, 53, 54],
'bbb': [15, 18, 20, 22, 25, 26, 27, 28, 29, 41, 42, 46],
'bba': [31],
'cbb': [33]})
Most of the algorithms below build on sax_via_window. Its full signature:
def sax_via_window(series, win_size, paa_size, alphabet_size=3,
nr_strategy='exact', znorm_threshold=0.01, sax_type='unidim')
nr_strategy is the numerosity reduction strategy ('exact', 'mindist', or None), which
collapses runs of identical or near-identical consecutive words. sax_type selects the
per-window strategy: 'unidim' (the default, for 1-D series) or one of the three
multi-dimensional modes below.
3.1 Multi-dimensional SAX (SAX-ENERGY / SAX-REPEAT / SAX-INDEPENDENT)
For a multi-dimensional series (an n x d array of n timestamps over d dimensions),
sax_type selects how the dimensions are combined [4]:
'independent': SAX-encode each dimension on its own and concatenate the per-dimension words;'energy': z-normalize across dimensions and aggregate the per-dimension energy;'repeat': run standard SAX per dimension, then k-means-cluster the multi-dimensional words into the requested alphabet.
For example, a 12-point, 2-dimensional series in the independent mode:
import numpy as np
from saxpy.sax import sax_via_window
mts = np.column_stack([np.sin(np.linspace(0, 3, 12)),
np.cos(np.linspace(0, 3, 12))])
sax_via_window(mts, win_size=6, paa_size=3, alphabet_size=3,
nr_strategy="none", znorm_threshold=0.01, sax_type="independent")
# defaultdict(list, {'abccba': [0, 1], 'acccba': [2], 'acbcba': [3], 'ccacba': [4], 'cbacba': [5, 6]})
Each six-letter word is the 3-letter word of dimension 0 followed by that of dimension 1.
Further reading: the paper that introduces these variants, Mohammad & Nishida, Robust learning from demonstrations using multidimensional SAX, ICCAS 2014 [4] (pp. 64-71), and an open-access walkthrough of SAX-REPEAT for multivariate series in Figueirêdo, Guarieiro & Nascimento, Multivariate Real Time Series Data Using Six Unsupervised Machine Learning Algorithms, IntechOpen 2020, §2.3.
4.0 Time series discord discovery with HOT-SAX
find_discords_hotsax implements the HOT-SAX discord discovery algorithm:
import numpy as np
from saxpy import find_discords_hotsax, ecg0606_path
dd = np.genfromtxt(ecg0606_path(), delimiter=",")
find_discords_hotsax(dd)
It returns the discords as (position, nearest-neighbour distance) pairs:
[(430, 5.279080006171839), (318, 4.175756357308694)]
The parameters are the sliding window size, the number of discords, the PAA and alphabet sizes, the z-normalization threshold, the SAX type, and a seed:
def find_discords_hotsax(series, win_size=100, num_discords=2, paa_size=3,
alphabet_size=3, znorm_threshold=0.01, sax_type='unidim',
random_state=None)
To verify discords or measure the HOT-SAX speed-up, saxpy also has a reference O(n²)
brute-force search, find_discords_brute_force(series, win_size, num_discords=2, znorm_threshold=0.01, random_state=None):
from saxpy.discord import find_discords_brute_force
find_discords_brute_force(dd[100:500], 100, 2)
# [(73, 6.198555329625451), (219, 5.563692399101613)]
In HOT-SAX, random_state fixes the search order, and with it the number of distance calls;
the brute-force search accepts it but does not use it. The discords are the same for every
seed, because ties are broken on the lowest index.
5.0 Grammar inference with RePair
str_to_repair_grammar infers a RePair grammar from a space-delimited string of SAX words (or
any tokens) and returns a dict mapping rule_id to a RepairRule. Rule 0 (R0) is the
compressed top-level string:
from saxpy.repair import str_to_repair_grammar
g = str_to_repair_grammar("abc abc cba cba bac xxx abc abc cba cba bac")
g[0].rule_string # 'R4 xxx R4'
g[4].expanded_rule_string # 'abc abc cba cba bac'
RePair is lossless: expanding R0 reproduces the input, and R0 has no repeated digram. The
algorithm repeatedly replaces the most frequent digram with a new rule. When several digrams
tie for the highest frequency, the one replaced first depends on the implementation
(priority-queue or hash-table order), so on tie-heavy inputs saxpy, R, and Java can produce
different rule ids and rule counts from the same SAX string. Treat rule_id as local to one
implementation.
6.0 Time series discord discovery with RRA
The Rare Rule Anomaly (RRA) algorithm builds a RePair grammar over the SAX representation,
derives variable-length subsequences from the grammar rules, and searches them rarest-first.
find_discords_rra implements it:
import numpy as np
from saxpy import find_discords_rra, ecg0606_path
dd = np.genfromtxt(ecg0606_path(), delimiter=",")
find_discords_rra(dd, win_size=100, num_discords=2)
It returns a list of variable-length RRADiscord records with start and end positions and the
nearest-neighbour distance:
[RRADiscord(rule_id=76, start=1722, end=1870, length=148, nn_distance=0.0557753630924654),
RRADiscord(rule_id=35, start=430, end=531, length=101, nn_distance=0.05258209490111305)]
nn_distance is computed between z-normalized subsequences, so RRA, like HOT-SAX, compares
shapes. The rarest-first search abandons candidates early, which makes nn_distance an
approximation that depends on the search order; the discord positions are stable. The
signature:
def find_discords_rra(series, win_size, paa_size=3, alphabet_size=3,
nr_strategy="none", znorm_threshold=0.01, num_discords=2,
random_state=0, span_cache_mb=256)
Memory vs speed. RRA compares the same grammar spans many times, so it caches each
z-normalized span for the whole search. span_cache_mb caps that cache (default 256 MiB). The
cap is a ceiling, not an allocation: the cache grows only to what the search needs, about
2.5–3 KiB per series point (12.8 MiB for stdb_308 at n = 5,400, 104 MiB for dutch_power at
n = 35,040). When the cap is reached, stored spans are still reused and new ones are computed
on every call. 0 disables the cache and None removes the cap. The results are identical
for every setting; only time and memory change (single runs; the "off" row is the
master-era search time from the performance tables):
span_cache_mb |
stdb_308 search | dutch_power search |
|---|---|---|
| 0 (off) | 18.2 s | 220 s |
| 8 | 5.6 s | — |
| 16 | 2.6 s | 183 s |
| 64 | 2.6 s | 48.5 s |
| 256 (default) | 2.6 s | 29.7 s |
The speedup appears once the budget covers about half of the search's working set, so the default gives full speed up to roughly 85,000 points. For longer series, raise the cap if the memory is available, or keep it as a bound.
7.0 Time series classification with SAX-VSM
SAX-VSM turns each training class into a single bag of SAX words, weights the words with
TF*IDF, and assigns a new series to the class whose weight vector is closest in cosine angle [5].
saxpy provides the building blocks (series_to_wordbag, manyseries_to_wordbag,
bags_to_tfidf, cosine_distance, class_for_bag) and a convenience layer on top of them
(load_ucr_data, train_tfidf, classify_series, classification_accuracy).
On the Cylinder-Bell-Funnel dataset in the repository (run from the clone's root directory):
from saxpy.saxvsm import load_ucr_data, train_tfidf, classification_accuracy
# UCR/jMotif text format: class label in column 0, series values after.
train = load_ucr_data("resources/data/cbf/CBF_TRAIN") # {'1': [...], '2': [...], '3': [...]}
test = load_ucr_data("resources/data/cbf/CBF_TEST")
# build the per-class TF*IDF vectors, then score the test split
tfidf = train_tfidf(train, win_size=60, paa_size=8, alphabet_size=6,
nr_strategy="exact", znorm_threshold=0.01)
classification_accuracy(test, tfidf, 60, 8, 6, "exact", 0.01)
# 1.0 (all 900 test series classified correctly)
bags_to_tfidf and train_tfidf take an optional tf_scheme: "log1p" (the default,
ln(1 + tf)) or "smart" (1 + ln(tf)); Cross-implementation alignment
explains the default. classify_series(series, tfidf, win_size, paa_size, ...) classifies a
single series and returns the predicted label, or None when every class ties.
7.1 SAX-VSM discretization parameters optimization
The window, PAA, and alphabet sizes are the hidden parameters of SAX-VSM. saxpy selects them by
minimizing the leave-out cross-validation error on the training set with the DIRECT global
optimizer (scipy.optimize.direct), the same recipe as the Java DiRect sampler and the
jmotif-R README. Continuing from §7.0:
import numpy as np
from saxpy.saxvsm_optimize import optimize_parameters
X = np.array([s for series in train.values() for s in series])
y = np.array([lbl for lbl, series in train.items() for _ in series])
optimize_parameters(X, y, max_iter=10, random_state=0)
# {'window_size': 65, 'paa_size': 12, 'alphabet_size': 4,
# 'cv_error': 0.0, 'evaluations': [...], 'nfev': 11}
optimize_parameters is deterministic for a fixed random_state. The CV objective is also
available as cv_error(train_data, train_labels, params, ...) for scoring a single parameter
point. Run independently, saxpy, jmotif-R, and Java each pick their own optimum and reach the
same test accuracy on the datasets we checked (CBF, Coffee, Gun_Point, Beef).
8.0 Time series motif discovery with EMMA
saxpy does not implement EMMA, the motif (recurrent pattern) counterpart to HOT-SAX, and no port is planned. Use the Java SAX library for EMMA.
Cross-implementation alignment
The lowest-level steps (z-normalization, PAA segment means, Gaussian breakpoints, symbol assignment) follow the same rules in saxpy, jmotif-R, and Java:
- z-normalization uses the population standard deviation (divide by
n), the Matrix Profile / MASS convention; - univariate z-normalization and PAA use left-to-right sequential summation, as jmotif-R (
_paa2,_znorm) and Java (TSProcessor.paa,TSProcessor.znorm) do, rather than NumPy pairwise reductions, so a PAA segment mean near zero gets the same symbol in every implementation; - PAA uses fractional segment boundaries (a sample straddling a segment edge is split by overlap);
- a value exactly on a breakpoint maps to the symbol above the cut;
- distance-based discord search compares z-normalized subsequences; HOT-SAX and brute force break distance ties on the lowest index.
Higher layers can differ in detail. RePair may assign different rule ids or counts when
digram frequencies tie (§5.0). RRA nn_distance depends on the search order (§6.0). Java
NewRepair can shift a variable-length RRA span by one index relative to saxpy and R while
overlapping the same HOT-SAX region, so the conformance tests check overlap rather than exact
span boundaries.
SAX-VSM uses the same TF*IDF weight in saxpy, jmotif-R, and Java sax-vsm_classic:
log1p term frequency, ln(1 + tf), with a natural-log IDF, ln(N / df). In a
cross-implementation study on CBF, Gun_Point, Coffee, Beef, OSULeaf, and Adiac, log1p tied or
beat the SMART scheme (1 + ln(tf), log10 IDF, which sax-vsm_classic used before) at the
tuned parameters on every dataset. The IDF base is a per-word constant factor that cancels in
the cosine, so it changes the printed weights but never a classification. On
Cylinder-Bell-Funnel all three implementations classify 900/900 test series correctly at
window 60, PAA 8, alphabet 6, with EXACT numerosity reduction.
jmotif-conformance holds the shared test cases and the details.
Algorithm performance
These numbers describe saxpy as a reference Python implementation. Use them to judge scale; when raw speed matters, use the R or Java implementations.
Each row is a real, non-periodic signal of that length (tiling or exact repetition makes
discord search pathological, so it is avoided), discretized with win=100, paa=4, alphabet=4,
finding two discords with random_state=0. Each length is a different signal, so read the
rows as real-world cost at that scale, not as a controlled scaling curve. Measured on an AMD
Ryzen 9 5950X (one core, Python 3.12, NumPy 2.5) with a standalone benchmark harness. The
HOT-SAX timings include the blocked random-phase scan and the RRA timings the span cache, both
new in 2.1.0 (see CHANGELOG.md).
Count distance calls, not seconds
A discord search is a nearest-neighbour search, and its work is the number of
subsequence-to-subsequence distances it computes. That count is fixed by the algorithm and the
data: it is deterministic for a fixed random_state, the same on any CPU, and close to what
the R/C++ and Java implementations compute on the same data. Wall-clock time is not, because in
Python the cost of one distance depends far more on how it is computed than on the algorithm:
| how one distance is computed | search time per distance |
|---|---|
| brute force: a whole row of distances in one vectorized NumPy call | ~0.1 µs |
| HOT-SAX: same-word neighbours one Python-level call each, the rest in growing blocks of one NumPy call | ~0.6–1.6 µs |
| RRA: variable-length spans, one Python-level call each; each span z-normalized and PAA-reduced once, then cached | ~5–7 µs |
That spread of up to 70× per distance is larger than the differences between the algorithms at these sizes, so wall-clock time ranks implementation styles rather than algorithms. At n = 21,600, for example, RRA computes 0.17% of brute force's distances but takes 13% of its search time (9.7 s vs 73 s). Compare algorithms by distance calls; use wall-clock time to estimate how long a job takes in saxpy.
Distance calls (share of brute force in parentheses):
| n | dataset | brute-force | HOT-SAX | RRA |
|---|---|---|---|---|
| 2,299 | ecg0606 | 9,242,200 | 50,328 (0.54%) | 49,433 (0.53%) |
| 5,400 | stdb_308 | 55,146,303 | 926,574 (1.7%) | 479,346 (0.87%) |
| 21,600 | mitdbx_108 | 920,307,303 | 1,206,856 (0.13%) | 1,537,056 (0.17%) |
| 35,040 | dutch_power | 2,434,793,703 | 6,758,119 (0.28%) | 4,411,911 (0.18%) |
Brute force is O(n²) by construction. HOT-SAX and RRA are O(n²) only in the worst case; on these signals they compute 0.1–1.7% of brute force's distances.
Wall-clock, seconds, best of 3. For the three discord searches this is the search alone, the time spent inside the nearest-neighbour search. The setup before it (z-normalizing every window, building the SAX index or the RePair grammar) is listed separately as prep. SAX via window and RePair are the standalone building blocks; RePair runs over the SAX word string, not the raw series.
| n | dataset | SAX via window | RePair | brute-force search | HOT-SAX search | RRA search |
|---|---|---|---|---|---|---|
| 2,299 | ecg0606 | 0.08 | 0.006 | 0.70 | 0.08 | 0.33 |
| 5,400 | stdb_308 | 0.20 | 0.016 | 4.04 | 0.94 | 2.61 |
| 21,600 | mitdbx_108 | 0.79 | 0.100 | 73.15 | 0.94 | 9.67 |
| 35,040 | dutch_power | 1.30 | 0.182 | 244.25 | 3.88 | 24.99 |
| prep, all four lengths | 0.04–0.60 | 0.12–1.92 | 0.09–1.51 |
Peak memory, MiB above baseline (tracemalloc):
| n | dataset | SAX via window | RePair | brute-force | HOT-SAX | RRA |
|---|---|---|---|---|---|---|
| 2,299 | ecg0606 | 0.1 | 0.8 | 3.9 | 3.7 | 6.0 |
| 5,400 | stdb_308 | 0.1 | 1.8 | 9.3 | 8.9 | 14.6 |
| 21,600 | mitdbx_108 | 0.3 | 7.0 | 37.9 | 35.9 | 66.3 |
| 35,040 | dutch_power | 0.6 | 11.3 | 61.9 | 58.4 | 116.3 |
For brute force and HOT-SAX the peak is the up-front table of z-normalized windows (about
n × win floats, built once before the search), which is why the two are nearly equal. For RRA
it is the cache of z-normalized spans, which fills during the search and holds one array per
distinct (span, compared length) pair. It is capped by span_cache_mb (default 256 MiB, so
none of these rows hits the cap). With span_cache_mb=0 RRA keeps no cache: its peak is then
1.0–15.3 MiB on these rows and its search runs about 45–50 µs per distance, 6.6–8.8× slower.
SAX-VSM (Cylinder-Bell-Funnel, 30 train / 900 test):
| operation | wall-clock | peak memory |
|---|---|---|
train_tfidf + classification_accuracy (all 900 test series) |
8.6 s | 0.5 MiB |
optimize_parameters (max_iter=10, leave-out CV) |
86.0 s | 1.8 MiB |
What's new
2.1.0 (December 2026, PyPI): faster discord search.
- HOT-SAX is 1.4–3.8× faster: the random-phase scan computes distances in blocks, with identical results.
- RRA is 6.6–8.8× faster: it caches z-normalized spans for the whole search, with identical results. The new
span_cache_mbargument (default 256 MiB) caps the cache's memory; see §6.0. - HOT-SAX returns plain
floatdistances.
Earlier releases and unreleased changes on master are in CHANGELOG.md.
References
[1] Lin, J., Keogh, E., Patel, P., and Lonardi, S., Finding Motifs in Time Series, The 2nd Workshop on Temporal Data Mining, the 8th ACM Int'l Conference on KDD (2002)
[2] Patel, P., Keogh, E., Lin, J., Lonardi, S., Mining Motifs in Massive Time Series Databases, In Proc. ICDM (2002)
[3] Keogh, E., Lin, J., Fu, A., HOT SAX: Efficiently finding the most unusual time series subsequence, In Proc. ICDM (2005)
[4] Mohammad, Y., Nishida T., Robust learning from demonstrations using multidimensional SAX, 2014 14th International Conference on Control, Automation and Systems (ICCAS 2014)
[5] Senin, P., and Malinchik, S., SAX-VSM: Interpretable Time Series Classification Using SAX and Vector Space Model, Data Mining (ICDM), 2013 IEEE 13th International Conference on, pp. 1175-1180 (2013)
[6] Salton, G., Wong, A., Yang, C., A vector space model for automatic indexing, Commun. ACM 18, 11, 613-620 (1975)
[7] Larsson, N.J., and Moffat, A., Offline dictionary-based compression, In Data Compression Conference (1999)
[8] Senin, P., Lin, J., Wang, X., Oates, T., Gandhi, S., Boedihardjo, A.P., Chen, C., Frankenstein, S., Time series anomaly discovery with grammar-based compression, In Proc. of the International Conference on Extending Database Technology, EDBT (2015)
Citing this work
For the SAX stack, discord search, and the SAX-VSM classifier, cite [5] (Senin & Malinchik, ICDM 2013).
For grammar-based pattern discovery (RePair, RRA), cite the GrammarViz 3.0 paper: Senin, P., Lin, J., Wang, X., Oates, T., Gandhi, S., Boedihardjo, A.P., Chen, C., Frankenstein, S., GrammarViz 3.0: Interactive Discovery of Variable-Length Time Series Patterns, ACM Trans. Knowl. Discov. Data, February 2018.
[Click here for Citation BibTeX]
Made with Aloha!
Metadata
Release files for saxpy 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| saxpy-2.1.0.tar.gz | 65.8 kB | Without provenance | Details for saxpy-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| saxpy-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for saxpy-2.1.0-py3-none-any.whl |
Total release size: 123.7 kB
Release files / saxpy-2.1.0.tar.gz
| Download URL | saxpy-2.1.0.tar.gz |
|---|---|
| Size | 65.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
997c28f3bce5b3373c9dc3145a7d2f11f64462bd749e325b51548e6847ddb83b
|
|
BLAKE2b-256 checksum How to use checksums |
218af6f3457ae060a306f05eba2e4a02c59447a3bf9f79d1de63dcf4015072fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / saxpy-2.1.0-py3-none-any.whl
| Download URL | saxpy-2.1.0-py3-none-any.whl |
|---|---|
| Size | 58.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab57f763016f63286b47de4dcebf62d36902c9feb98f59f9d02f2b9a19afdacb
|
|
BLAKE2b-256 checksum How to use checksums |
00ac216ff88345bc2454db512e859e123b5db7bf4ad764628cbc767435b273b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for saxpy 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.