All models

TS2Vec time-series representation

Dilated CNN encoder trained with hierarchical contrastive learning to represent every timestamp of a series.

Time series · 69 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (49 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
637.2K
Operations
69
Framework
PyTorch
Recurrent
No
Published
AAAI 2022
Cited by
846 (as of 27 October 2026)
Authors
Zhihan Yue, Yujing Wang, Juanyong Duan and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m20848
Graph hash
e3138543f0fb50c49f89fb5b8ccf16614ad07e1a5d29722462759d7c2a716c7f
Skeleton hash
b5d21c8c0bd3a7d752ce5c28435a905aad0a8631aa81bdf470ade7fb23570a24
Architecture hash
a6813ab379badb80951f330c1dca77d512d927505ed8ed5262c8c8c6e85ae436
Diagram SHA-256
472e2758f554ebe555f71d574784334c415eeb2bf65aca323bc4b591bdadbbda
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

TS2Vec is a framework for learning representations of time series that can be read at any level of detail, from a single timestamp to a whole series. It learns a contextual representation for each timestamp by contrastive learning, applied hierarchically over augmented context views. The representation of any sub-sequence is then obtained by a simple aggregation over the representations of its timestamps.

The encoder has three components: an input projection layer, a timestamp masking module and a dilated CNN module. Masking is applied to the latent vectors and not to the raw values, because the value range of a time series may be unbounded and no special token can be found for raw data. The dilated CNN module has ten residual blocks and extracts the contextual representation at each timestamp.

The paper evaluates on time series classification with 125 UCR datasets and 29 UEA datasets and reports a significant improvement over earlier unsupervised representation methods. It also reports that a linear regression trained on the learned representations outperformed earlier methods for time series forecasting.

Key idea. TS2Vec performs contrastive learning hierarchically over augmented context views, giving a contextual representation for every timestamp that can be aggregated for any sub-sequence.

  • TS2Vec
  • time series representation
  • universal time series representation
  • time series representation learning
  • hierarchical contrastive learning
  • time series classification
  • time series forecasting
  • time series anomaly detection
  • unsupervised representation learning

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{yue2022ts2vecuniversalrepresentationtime,
      title={TS2Vec: Towards Universal Representation of Time Series}, 
      author={Zhihan Yue and Yujing Wang and Juanyong Duan and Tianmeng Yang and Congrui Huang and Yunhai Tong and Bixiong Xu},
      year={2022},
      eprint={2106.10466},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2106.10466}, 
}