tsseg.algorithms.vqtss package
VQ-TSS — Vector Quantized Time Series Segmentation.
Description
VQ-TSS is a predictive segmentation model that learns discrete state codes via a VQ-VAE bottleneck:
Encoder — dilated residual convolutions map sliding windows to a continuous latent space.
Vector Quantisation — an EMA-updated codebook discretises the latent vectors into a finite set of state codes.
Predictor — an InfoNCE objective trains the predictor to match the next-step continuous latent, encouraging the codebook to capture semantically meaningful states.
A temporal-smoothness regulariser discourages rapid label switching.
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Sliding-window length for training. |
|
int |
|
Stride for sliding-window extraction. |
|
int |
|
Latent / codebook dimension. |
|
int |
|
Number of VQ codebook entries (max discrete states). |
|
float |
|
VQ commitment-loss coefficient. |
|
float |
|
EMA decay for codebook updates. |
|
float |
|
Temporal-smoothness regularisation weight. |
|
float |
|
Temperature for InfoNCE logits. |
|
int |
|
Timesteps within +/- margin masked from negatives. |
|
float |
|
Adam learning rate. |
|
int |
|
Mini-batch size. |
|
int |
|
Training epochs. |
|
float |
|
Gradient clipping (0 = disable). |
|
str / None |
|
PyTorch device (auto-detected if |
|
int / None |
|
Random seed. |
|
int |
|
Time axis. |
Usage
from tsseg.algorithms import VQTSSDetector
detector = VQTSSDetector(window_size=128, num_embeddings=32, epochs=20)
states = detector.fit_predict(X)
Implementation: Origin: new code.
Reference: —