Skip to main content
← Lab

saxpivot

confirmedupstream bugPython · tslearnSystems & data structuresJuly 25, 2026

the question

Does tslearn's 1d-SAX distance match the Euclidean distance between its own reconstructions?

what came out

tslearn/metrics/cysax.py cydist_1d_sax evaluates segment lines about pivot t0+seg_sz/2 while inv_transform_1d_sax and the slope fit use t0+(seg_sz-1)/2. distance_1d_sax gives 4.83954 versus 4.34056 for the L2 of its own inverse_transform, an 11.5% gap that scales with slope difference.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/saxpivot