  Time series remains one of the most challenging modalities in machine
learning research. The out-of-distribution (OOD) detection and generalization
on time series tend to suffer due to its non-stationary property, i.e., the
distribution changes over time. The dynamic distributions inside time series
pose great challenges to existing algorithms to identify invariant
distributions since they mainly focus on the scenario where the domain
information is given as prior knowledge. In this paper, we attempt to exploit
subdomains within a whole dataset to counteract issues induced by
non-stationary for generalized representation learning. We propose DIVERSIFY, a
general framework, for OOD detection and generalization on dynamic
distributions of time series. DIVERSIFY takes an iterative process: it first
obtains the "worst-case" latent distribution scenario via adversarial training,
then reduces the gap between these latent distributions. We implement DIVERSIFY
via combining existing OOD detection methods according to either extracted
features or outputs of models for detection while we also directly utilize
outputs for classification. In addition, theoretical insights illustrate that
DIVERSIFY is theoretically supported. Extensive experiments are conducted on
seven datasets with different OOD settings across gesture recognition, speech
commands recognition, wearable stress and affect detection, and sensor-based
human activity recognition. Qualitative and quantitative results demonstrate
that DIVERSIFY learns more generalized features and significantly outperforms
other baselines.
