# unit8co/darts architecture

> Architecture diagram of the GitHub repository unit8co/darts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unit8co/darts
- Repository: https://github.com/unit8co/darts

## Overview

Darts is a Python library for representing, transforming, forecasting, and detecting anomalies in time series. A typical workflow creates or loads a `TimeSeries`, optionally transforms it or adds encoded covariates, fits a forecasting model, and predicts or backtests; alternatively, anomaly scorers produce scores that detectors classify and aggregators combine. Forecasting includes statistical, machine-learning, neural, probabilistic, and conformal models. Additional branches support filtering, metrics, explanations, and ONNX inference. The graph reflects the README and sampled sources; unsampled subsystem wiring is omitted where calls cannot be verified.

Main entry points: [`darts/dataprocessing/pipeline.py`](https://github.com/unit8co/darts/blob/master/darts/dataprocessing/pipeline.py) (Transform pipeline), [`darts/ad/anomaly_model`](https://github.com/unit8co/darts/tree/master/darts/ad/anomaly_model) (Anomaly wrappers), [`darts/models/forecasting`](https://github.com/unit8co/darts/tree/master/darts/models/forecasting) (Forecasting models), [`darts/utils/onnx/inference.py`](https://github.com/unit8co/darts/blob/master/darts/utils/onnx/inference.py) (ONNX inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_series["Series and Preparation"]
  node_timeseries["TimeSeries<br/>[timeseries.py]"]
  node_datasets["Dataset loaders<br/>[datasets.py]"]
  node_transformers["Transformers"]
  node_pipeline["Transform pipeline<br/>[pipeline.py]"]
  node_encoders["Covariate encoders<br/>[encoders.py]"]
end

subgraph group_forecast["Forecasting"]
  node_forecastmodels["Forecasting models"]
  node_forecastbase["Forecasting base"]
  node_torchdatasets["Inference datasets"]
  node_filtering["Filtering models"]
end

subgraph group_anomaly["Anomaly Detection"]
  node_anomalyscorers["Anomaly scorers"]
  node_detectors["Anomaly detectors"]
  node_aggregators["Score aggregators"]
  node_anommodels["Anomaly wrappers"]
end

subgraph group_analysis["Evaluation and Analysis"]
  node_metrics["Forecast metrics<br/>[metrics.py]"]
  node_explainability["Model explanations"]
end

subgraph group_deployment["Model Interoperability"]
  node_onnxexport["ONNX export<br/>[export.py]"]
  node_onnxinference["ONNX inference<br/>[inference.py]"]
end

node_user(("Library user"))
node_onnxruntime["ONNX Runtime"]

node_user -->|"loads data"| node_datasets
node_datasets -->|"returns series"| node_timeseries
node_user -->|"creates series"| node_timeseries
node_user -->|"transforms series"| node_pipeline
node_pipeline -->|"applies transforms"| node_transformers
node_pipeline -->|"transforms data"| node_timeseries
node_user -->|"generates covariates"| node_encoders
node_user -->|"fits and predicts"| node_forecastmodels
node_forecastmodels -->|"inherits behavior"| node_forecastbase
node_forecastbase -->|"builds inference data"| node_torchdatasets
node_user -->|"filters series"| node_filtering
node_user -->|"scores series"| node_anomalyscorers
node_user -->|"classifies scores"| node_detectors
node_user -->|"combines scores"| node_aggregators
node_user -->|"runs anomaly model"| node_anommodels
node_anommodels -.->|"uses forecasters"| node_forecastmodels
node_anommodels -.->|"uses filters"| node_filtering
node_user -->|"evaluates forecasts"| node_metrics
node_user -->|"explains model"| node_explainability
node_user -->|"exports model"| node_onnxexport
node_user -->|"runs inference"| node_onnxinference
node_onnxinference -->|"runs session"| node_onnxruntime
node_onnxruntime -->|"returns outputs"| node_onnxinference

click node_timeseries "https://github.com/unit8co/darts/blob/master/darts/timeseries.py"
click node_datasets "https://github.com/unit8co/darts/blob/master/darts/datasets/datasets.py"
click node_transformers "https://github.com/unit8co/darts/tree/master/darts/dataprocessing/transformers"
click node_pipeline "https://github.com/unit8co/darts/blob/master/darts/dataprocessing/pipeline.py"
click node_encoders "https://github.com/unit8co/darts/blob/master/darts/dataprocessing/encoders/encoders.py"
click node_forecastmodels "https://github.com/unit8co/darts/tree/master/darts/models/forecasting"
click node_forecastbase "https://github.com/unit8co/darts/blob/master/darts/models/forecasting/forecasting_model.py"
click node_torchdatasets "https://github.com/unit8co/darts/blob/master/darts/utils/data/torch_datasets/inference_dataset.py"
click node_filtering "https://github.com/unit8co/darts/tree/master/darts/models/filtering"
click node_anomalyscorers "https://github.com/unit8co/darts/tree/master/darts/ad/scorers"
click node_detectors "https://github.com/unit8co/darts/tree/master/darts/ad/detectors"
click node_aggregators "https://github.com/unit8co/darts/tree/master/darts/ad/aggregators"
click node_anommodels "https://github.com/unit8co/darts/tree/master/darts/ad/anomaly_model"
click node_metrics "https://github.com/unit8co/darts/blob/master/darts/metrics/metrics.py"
click node_explainability "https://github.com/unit8co/darts/tree/master/darts/explainability"
click node_onnxexport "https://github.com/unit8co/darts/blob/master/darts/utils/onnx/export.py"
click node_onnxinference "https://github.com/unit8co/darts/blob/master/darts/utils/onnx/inference.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_timeseries,node_datasets,node_transformers,node_pipeline,node_encoders,node_user toneBlue
class node_forecastmodels,node_forecastbase,node_torchdatasets,node_filtering toneAmber
class node_anomalyscorers,node_detectors,node_aggregators,node_anommodels toneMint
class node_metrics,node_explainability toneRose
class node_onnxexport,node_onnxinference,node_onnxruntime toneIndigo
```

## Components

### Series and Preparation

- [TimeSeries](https://github.com/unit8co/darts/blob/master/darts/timeseries.py): `darts/timeseries.py`
- [Dataset loaders](https://github.com/unit8co/darts/blob/master/darts/datasets/datasets.py): `darts/datasets/datasets.py`
- [Transformers](https://github.com/unit8co/darts/tree/master/darts/dataprocessing/transformers): `darts/dataprocessing/transformers`
- [Transform pipeline](https://github.com/unit8co/darts/blob/master/darts/dataprocessing/pipeline.py): `darts/dataprocessing/pipeline.py`
- [Covariate encoders](https://github.com/unit8co/darts/blob/master/darts/dataprocessing/encoders/encoders.py): `darts/dataprocessing/encoders/encoders.py`

### Forecasting

- [Forecasting models](https://github.com/unit8co/darts/tree/master/darts/models/forecasting): `darts/models/forecasting`
- [Forecasting base](https://github.com/unit8co/darts/blob/master/darts/models/forecasting/forecasting_model.py): `darts/models/forecasting/forecasting_model.py`
- [Inference datasets](https://github.com/unit8co/darts/blob/master/darts/utils/data/torch_datasets/inference_dataset.py): `darts/utils/data/torch_datasets/inference_dataset.py`
- [Filtering models](https://github.com/unit8co/darts/tree/master/darts/models/filtering): `darts/models/filtering`

### Anomaly Detection

- [Anomaly scorers](https://github.com/unit8co/darts/tree/master/darts/ad/scorers): `darts/ad/scorers`
- [Anomaly detectors](https://github.com/unit8co/darts/tree/master/darts/ad/detectors): `darts/ad/detectors`
- [Score aggregators](https://github.com/unit8co/darts/tree/master/darts/ad/aggregators): `darts/ad/aggregators`
- [Anomaly wrappers](https://github.com/unit8co/darts/tree/master/darts/ad/anomaly_model): `darts/ad/anomaly_model`

### Evaluation and Analysis

- [Forecast metrics](https://github.com/unit8co/darts/blob/master/darts/metrics/metrics.py): `darts/metrics/metrics.py`
- [Model explanations](https://github.com/unit8co/darts/tree/master/darts/explainability): `darts/explainability`

### Model Interoperability

- [ONNX export](https://github.com/unit8co/darts/blob/master/darts/utils/onnx/export.py): `darts/utils/onnx/export.py`
- [ONNX inference](https://github.com/unit8co/darts/blob/master/darts/utils/onnx/inference.py): `darts/utils/onnx/inference.py`

### Other components

- **Library user**
- **ONNX Runtime**

## Connections

- Library user → Dataset loaders: loads data
- Dataset loaders → TimeSeries: returns series
- Library user → TimeSeries: creates series
- Library user → Transform pipeline: transforms series
- Transform pipeline → Transformers: applies transforms
- Transform pipeline → TimeSeries: transforms data
- Library user → Covariate encoders: generates covariates
- Library user → Forecasting models: fits and predicts
- Forecasting models → Forecasting base: inherits behavior
- Forecasting base → Inference datasets: builds inference data
- Library user → Filtering models: filters series
- Library user → Anomaly scorers: scores series
- Library user → Anomaly detectors: classifies scores
- Library user → Score aggregators: combines scores
- Library user → Anomaly wrappers: runs anomaly model
- Anomaly wrappers → Forecasting models: uses forecasters
- Anomaly wrappers → Filtering models: uses filters
- Library user → Forecast metrics: evaluates forecasts
- Library user → Model explanations: explains model
- Library user → ONNX export: exports model
- Library user → ONNX inference: runs inference
- ONNX inference → ONNX Runtime: runs session
- ONNX Runtime → ONNX inference: returns outputs
