How salesforce/merlion works
Merlion is a time-series intelligence library, with separate anomaly-detection, forecasting, and change-point capabilities. Its principal workflow is to load time-series data, transform it, train or apply a model, post-process anomaly scores where relevant, and evaluate results. It also offers model selection, ensembles, visualization, a clickable dashboard, and a PySpark backend. The graph includes documented dataset and benchmarking support. Some subsystem links rely on README descriptions or SOURCE INDEX references; unsampled implementation details are not assumed.
Main entry points: models Dashboard model workflows · factory.py Model factory · anomaly Anomaly and change-point models · forecast Forecasting models
Components 22
Data and transforms
- Dataset loaders
ts_datasets/ts_datasets - Time-series representation
merlion/utils/time_series.py - Preprocessing transforms
merlion/transform - Resampling
merlion/transform/resample.py
Modeling
- Model factory
merlion/models/factory.py - Anomaly and change-point models
merlion/models/anomaly - Forecasting models
merlion/models/forecast - Automated model selection
merlion/models/automl - Model ensembles
merlion/models/ensemble - Anomaly post-processing
merlion/post_process
Evaluation and benchmarking
- Evaluation framework
merlion/evaluate/base.py - Anomaly evaluation
merlion/evaluate/anomaly.py - Forecast evaluation
merlion/evaluate/forecast.py - Benchmark runners
benchmark_anomaly.py
User interfaces and scale
- Prediction visualization
merlion/plot.py - Interactive dashboard
merlion/dashboard/server.py - Dashboard callbacks
merlion/dashboard/callbacks - Dashboard model workflows
merlion/dashboard/models - Dashboard file manager
merlion/dashboard/utils/file_manager.py - Distributed backend
merlion/spark/pandas_udf.py - Spark dataset operations
merlion/spark/dataset.py
Other components
- Engineer
Connections 30
- Engineer → Dataset loaders: load data
- Dataset loaders → Time-series representation: provide series
- Time-series representation → Preprocessing transforms: transform inputs
merlion/models/base.py - Preprocessing transforms → Resampling: supports resampling
merlion/transform/resample.py - Engineer → Model factory: configure model
- Model factory → Anomaly and change-point models: create detector
- Model factory → Forecasting models: create forecaster
- Anomaly and change-point models → Anomaly post-processing: post-process scores
merlion/models/anomaly/base.py - Anomaly and change-point models → Prediction visualization: plot predictions
merlion/models/anomaly/base.py - Forecasting models → Prediction visualization: plot predictions
merlion/models/forecast/base.py - Automated model selection → Forecasting models: select models
- Model ensembles → Anomaly and change-point models: combine outputs
merlion/models/ensemble/anomaly.py - Model ensembles → Forecasting models: combine outputs
- Anomaly evaluation → Evaluation framework: uses evaluator base
merlion/evaluate/anomaly.py - Forecast evaluation → Evaluation framework: uses evaluator base
merlion/evaluate/forecast.py - Anomaly evaluation → Anomaly and change-point models: evaluates detector
merlion/evaluate/anomaly.py - Forecast evaluation → Forecasting models: evaluates forecaster
merlion/evaluate/forecast.py - Benchmark runners → Anomaly evaluation: runs evaluation
benchmark_anomaly.py - Benchmark runners → Dataset loaders: loads benchmarks
benchmark_anomaly.py - Engineer → Interactive dashboard: open dashboard
- Interactive dashboard → Dashboard callbacks: registers callbacks
merlion/dashboard/server.py - Interactive dashboard → Dashboard model workflows: registers pages
merlion/dashboard/server.py - Dashboard callbacks → Dashboard model workflows: invoke workflows
merlion/dashboard/callbacks/anomaly.py - Dashboard callbacks → Dashboard file manager: accesses files
merlion/dashboard/callbacks/anomaly.py - Dashboard model workflows → Model factory: creates models
merlion/dashboard/models/anomaly.py - Dashboard model workflows → Anomaly evaluation: evaluates results
merlion/dashboard/models/anomaly.py - Dashboard model workflows → Prediction visualization: visualizes results
merlion/dashboard/models/anomaly.py - Spark dataset operations → Distributed backend: supports UDFs
merlion/spark/pandas_udf.py - Distributed backend → Model factory: instantiates models
merlion/spark/pandas_udf.py - Engineer → Distributed backend: run distributed jobs