merlion: Time Series Intelligence

merlion is a Python library for time series intelligence. We support the following key features, each associated with its own sub-package:

  • merlion.models: A library of models unified under a single shared interface, with specializations for anomaly detection and forecasting. More specifically, we have

  • merlion.dashboard: A GUI dashboard app for Merlion, which can be started with python -m merlion.dashboard. This dashboard provides a good way to quickly experiment many models on a new time series.

  • merlion.spark: APIs to integrate Merlion with PySpark for using distributed computing to run training and inference on multiple time series in parallel.

  • merlion.transform: Data pre-processing layer which implements many standard data transformations used in time series analysis. Transforms are callable objects, and each model has its own configurable model.transform which it uses to pre-process all input time series for both training and inference.

  • merlion.post_process: Post-processing rules to apply on the output of a model. Currently, these are specific to anomaly detection, and include

    • merlion.post_process.calibrate: Rules to calibrate the anomaly scores returned by a model, to be interpretable as z-scores, i.e. as standard deviations of a standard normal random variable. Each anomaly detection model has a model.calibrator from this module, which can optionally be applied to ensure that the model’s anomaly scores are calibrated.

    • merlion.post_process.threshold: Rules to reduce the noisiness of an anomaly detection model’s outputs. Each anomaly detection model has a model.threshold from this module, which can optionally be applied to filter the model’s predicted sequence of anomaly scores.

  • merlion.evaluate: Evaluation metrics & pipelines to simulate the live deployment of a time series model for any task.

  • merlion.plot: Automated visualization of model outputs for univariate time series

  • merlion.utils: Various utilities, including the TimeSeries class, resampling functions, Bayesian conjugate priors, reconciliation for hierarchical time series, and more.

The key classes for input and output are merlion.utils.time_series.TimeSeries and merlion.utils.time_series.UnivariateTimeSeries. Notably, these classes have transparent inter-operability with pandas.DataFrame and pandas.Series, respectively. Check this tutorial for some examples on how to use these classes, or the API docs linked above for a full list of features.

The full API documentation is outlined below: