  Forecasting tasks using large datasets gathering thousands of heterogeneous
time series is a crucial statistical problem in numerous sectors. The main
challenge is to model a rich variety of time series, leverage any available
external signals and provide sharp predictions with statistical guarantees. In
this work, we propose a new forecasting model that combines discrete state
space hidden Markov models with recent neural network architectures and
training procedures inspired by vector quantized variational autoencoders. We
introduce a variational discrete posterior distribution of the latent states
given the observations and a two-stage training procedure to alternatively
train the parameters of the latent states and of the emission distributions. By
learning a collection of emission laws and temporarily activating them
depending on the hidden process dynamics, the proposed method allows to explore
large datasets and leverage available external signals. We assess the
performance of the proposed method using several datasets and show that it
outperforms other state-of-the-art solutions.
