Abstract
Darts is a Python library that unifies classical forecasting and modern deep learning under a single, scikit-learn-like API. It simplifies the complex workflow of time series modeling, allowing practitioners to train "global" models across thousands of series and generate probabilistic forecasts with minimal boilerplate code.
Introduction
Time series forecasting is critical for industries ranging from energy management to retail logistics. However, the field has historically been split into two worlds. On one side are classical statistical methods, which are robust but often limited to modeling a single series at a time. On the other are modern machine learning and deep learning (DL) approaches, which can learn complex patterns across massive datasets but often require bespoke, low-level code to handle data slicing, scaling, and covariate alignment.
Darts addresses this fragmentation by providing a high-level abstraction that makes switching between a simple Exponential Smoothing model and a complex multi-horizon Deep Learning model as easy as changing a single line of code.
Methods and Architecture
The core of Darts is built on several key architectural choices designed for robustness and ease of use:
- The
TimeSeriesObject: Instead of raw NumPy arrays, Darts uses a dedicated container based onxarray. This ensures data integrity (e.g., guaranteed sorted time indices) and handles dimensions for "time," "components" (multivariate columns), and "samples" (for probabilistic data). - Unified API: Every model implements a standard
fit()andpredict()interface. This allows for seamless backtesting, ensembling, and model comparison. - Global Model Support: Unlike classical models, Darts' ML models are "global," meaning they can be trained on a collection of hundreds or thousands of different series simultaneously to learn shared patterns.
- Covariate Handling: The library explicitly distinguishes between past covariates (data known only up to the present) and future covariates (data known into the future, like weather forecasts), reducing the risk of "data leakage."
- Probabilistic Forecasting: Rather than just predicting a single point, many Darts models can output distributions by storing Monte Carlo samples directly in the
TimeSeriesobject.
Key Insights
The "Scikit-Learn" philosophy for time series is the central innovation of Darts. By standardizing input/output as TimeSeries objects, the library handles the "plumbing" of neural networks (windowing, slicing, batching) internally. Furthermore, TimeSeries objects are immutable, which prevents accidental data corruption during complex preprocessing pipelines—a common source of bugs in forecasting. This model-agnosticism makes it trivial to create hybrid ensembles, combining the outputs of statistical models and neural networks.
Results and Usage
The library's utility is demonstrated by its ability to handle complex tasks with minimal code. For instance, a Temporal Convolutional Network (TCN) can be trained on multiple distinct datasets simultaneously to produce probabilistic outputs.
As illustrated in the figure, Darts provides built-in visualization tools to plot forecasts alongside the original series, including confidence intervals (e.g., 10th and 90th percentiles). The library also includes a darts.datasets module for easy access to standard benchmarks like the AirPassengers and MonthlyMilk datasets, and it is designed to scale to large industrial datasets using lazy data loading.
Limitations and Future Work
While Darts is a powerful tool, it remains an evolving project. Future work includes better support for static covariates (metadata like store location), the creation of a "Model Zoo" for transfer learning (similar to Hugging Face), and expanded filtering modules for state estimation and noise reduction.
Summary updated