Paper · 2021-10-07 · cs.LG, stat.CO
Darts: User-Friendly Modern Machine Learning for Time Series
Darts is a Python time-series library with one fit()/predict() API over classical, deep and probabilistic forecasters, a TimeSeries container for multivariate and sampled series, and past and future covariates. The paper reports no accuracy benchmarks; its example trains a TCN with a Laplace likelihood on two series.
Time series forecastingTemporal convolutional network (TCN)Ensemble learningsoftware-libraryforecastingtime-seriesprobabilistic-forecasting
arXivPDFCodeMarkdown7 min read
AI-compiled by claude-haiku-5-5 on 2026-11-01, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Darts is a Python library for forecasting time series: predicting the next values of a sequence measured over time, such as sales or energy use. Its aim is to put classical statistical models and modern neural networks behind one simple interface. You create a model, call fit() on your data and predict() to get a forecast, much as you would with scikit-learn.
The library also settles several design questions. Each series lives in one container that keeps its time axis, its several components and, for probabilistic forecasts, a set of sampled outcomes together. A model can be trained on many series at once, can take extra inputs that are known only up to the present, or known into the future too, and can output a range of possible futures instead of a single value.
The card's example trains one temporal convolutional network on two series and forecasts one of them with an uncertainty band. The paper is mainly about the API. It reports no accuracy benchmarks.
TL;DR
- Darts is a time-series library whose models share
fit()andpredict(n), including classical, deep and probabilistic ones [abstract] §2.2. - Series are stored in a
TimeSeriescontainer; probabilistic forecasts are Monte Carlo samples stored in that container §2.1 §2.5. - The paper reports no benchmark results. Its one worked example is a TCN with a Laplace likelihood on two series §3.
- The code is Apache-2.0 at a commit (version 0.48.1) much later than the paper, so its API details differ from the paper's era.
Problem
Classical forecasting methods are usually fitted one model per series, while machine-learning models work best when trained across many series §1 §2.3. The paper says existing toolkits either focus on classical methods, lack deep learning or multi-series training, or expose lower-level APIs §1. It proposes a higher-level API that covers both classical and ML forecasters and handles multidimensional series, external covariates, ensembling and probabilistic output [abstract] §1.
Method
The "method" is a software design. The paper states six design points, which are the parts an implementer must reproduce to use the library as intended.
- Series container.
TimeSerieswraps a three-dimensional xarrayDataArraywith dimensions time, component and sample, in that order §2.1 timeseries.py. The time index is either a pandasDatetimeIndexor aRangeIndex§2.1. Components are the variables of a multivariate series; samples are Monte Carlo draws of a stochastic series §2.1 timeseries.py. - Common API. Every model supports
fit(series)andpredict(n), which forecastsnsteps after the end of the series. Most models also accept a sequence of series infit§2.2 torch_forecasting_model.py torch_forecasting_model.py. The paper says the interface is similar to scikit-learn'sfit/predict[abstract]. - Training on many series. Each model has a default way of slicing series into (input, output) training samples. Users can define their own slicing §2.3. Neural models use PyTorch and can run on GPUs §2.3. Large datasets that do not fit in memory are handled by a custom lazily loading
Sequence§2.3. The code offersmax_samples_per_tsto cap the training samples taken from each series, keeping the most recent ones torch_forecasting_model.py. - Covariates. Models take
past_covariates(known only up to the present) andfuture_covariates(known into the future, such as forecasts). The separate arguments make it explicit whether future values are needed at prediction time §2.4 torch_forecasting_model.py torch_forecasting_model.py. Covariates need not share the target's time range; alignment is done on the time axes during slicing §2.4. - Probabilistic forecasts. Distributions are represented by stored Monte Carlo samples rather than a parametric form §2.5. Probabilistic deep models fit any likelihood whose negative log-likelihood is differentiable §2.5. The paper counts 17 built-in distributions and allows time-independent priors on distribution parameters §2.5. Example: the Laplace likelihood has location
muand scaleb > 0, with optional priorsprior_mu,prior_band aprior_strengthtorch.py. - Other features. Backtesting through
backtest()§2.6 forecasting_model.py; data transformers and pipelines; hyperparameter search; metrics; dynamic time warping; ensemble models, including one that learns the ensemble with a regression model §2.6 ensemble_model.py; Kalman filters and Gaussian processes §2.6; and adatasetsmodule of public series §2.6.
The usage example in the paper (§3) runs the following steps. It is written in pseudocode, not as the paper's exact listing.
# Two-series TCN example [§3]
# Input: two series (air, milk)
# Output: 48-step forecast, 500 Monte Carlo samples
def run_example():
# Load two datasets from darts.datasets as TimeSeries [§3]
air = load_air_passengers()
milk = load_monthly_milk()
# One scaler per series, each fitted on its own series [§3]
air_scaled = Scaler().fit_transform(air)
milk_scaled = Scaler().fit_transform(milk)
# Dilated TCN: 24 input steps, 12 output steps, Laplace output [§3]
model = TCNModel(
input_chunk_length=24,
output_chunk_length=12,
likelihood=LaplaceLikelihood(),
)
# Train on both series together for 100 epochs [§3]
model.fit([air_scaled, milk_scaled], epochs=100)
# Forecast 48 steps after the air series, 500 sample paths [§3]
return model.predict(
n=48,
series=air_scaled,
num_samples=500,
)Key equations: none. The paper contains no equations, algorithms or tables.
Hyperparameters
The paper gives only the example's settings. Every other value below comes from the code at code_commit. The paper says "default hyper-parameters" for the TCN §3 without listing them.
| Name | Value | Where | Notes |
|---|---|---|---|
| input_chunk_length | 24 | §3 | example value |
| output_chunk_length | 12 | §3 | example value; n=48 in the example is autoregressive, see Pitfalls |
| likelihood | Laplace (mu, b) | §3 torch.py | |
| epochs (fit) | 100 | §3 | overrides n_epochs when given torch_forecasting_model.py |
| predict n | 48 | §3 | |
| num_samples | 500 | §3 | Monte Carlo sample paths per forecast |
| plot quantiles | 0.1 and 0.9 | §3 | code plot defaults are 0.05 and 0.95 timeseries.py |
| scaler | Scaler(), no arguments | §3 | default is sklearn MinMaxScaler(feature_range=(0, 1)) scaler.py scaler.py |
| kernel_size | 3 | code default tcn_model.py | paper not stated |
| num_filters | 3 | code default tcn_model.py | paper not stated |
| dilation_base | 2 | code default tcn_model.py | paper not stated |
| num_layers | computed | tcn_model.py | derived from input_chunk_length, kernel_size and dilation_base; gives 3 for input 24, kernel 3, base 2 (worked from the code's formula) |
| dropout | 0.2 | code default tcn_model.py | paper not stated |
| weight_norm | False | code default tcn_model.py | paper not stated |
| batch_size | 32 | code default tcn_model.py | paper not stated |
| n_epochs | 100 | code default tcn_model.py | used when fit gets no epochs torch_forecasting_model.py |
| optimizer | torch Adam | code default tcn_model.py | learning rate not stated; the torch default is used unless optimizer_kwargs is set |
| loss | MSE, replaced by the likelihood | code default tcn_model.py | paper not stated |
| reversible instance norm | off | code default tcn_model.py | paper not stated |
Results
Author-reported. The paper reports no quantitative results: no benchmark, metric, baseline or accuracy figure. Its only empirical content is the usage example, which shows a forecast with a quantile band for the air series §3. That figure is uncaptioned and not numbered in the paper, so it is cited as §3 only.
Paper vs code
The code is the official Darts repository at commit 406ecda0ff7d6e20cf2e19effac5024308057c9f, version 0.48.1 pyproject.toml. It is much later than the paper, which describes the library as of 2021–2022. I did not execute the paper's example; the signatures it uses match this commit.
- Version. The paper's list of models and its "17 distributions" are a snapshot "at the time of writing" §2.2 §2.5. The code now ships further models, including foundation-model wrappers (for example chronos2_model.py, timesfm2p5_model.py and tirex_model.py). The likelihood classes are defined at torch.py. The code has 17 classes named
*LikelihoodplusQuantileRegression. The paper's count of 17 matches the class names, but the list is the current one, not the paper's. - TCN defaults. The paper calls the example's TCN configuration "default hyper-parameters" §3 without giving them. The defaults are in the constructor tcn_model.py. Only
input_chunk_length,output_chunk_lengthandlikelihoodare set in the example. - Autoregression. The paper's example calls
predict(n=48)on a model withoutput_chunk_length=12§3, which requires autoregressive prediction. The code documents this:ngreater thanoutput_chunk_lengthforecasts autoregressively tcn_model.py. The paper does not say so. - Epochs. The paper's
fit(..., epochs=100)matches the signature torch_forecasting_model.py. The docstring saysepochstrains that many additional epochs regardless ofn_epochstorch_forecasting_model.py. Without it,n_epochsis used torch_forecasting_model.py. - Quantile defaults. The paper passes quantiles 0.1 and 0.9 to
plot§3. The code's defaults are 0.05 and 0.95 timeseries.py. The example's values are explicit, so it is unaffected. - Immutability. The paper says
TimeSeriesobjects are immutable §2.1. The word does not appear indarts/timeseries.py. I did not verify this guarantee in the code. - Scaler range. The paper does not state the scaler's range. The code's default is (0, 1) scaler.py.
No other discrepancies found.
Pitfalls
- Paper vs current API. Code at this commit has moved on from the paper. Check the signatures in the commit before copying the paper's text. The paper's API names are still valid, but the model list and defaults are a later snapshot.
- Auto layer count. When
num_layersis not set, the TCN's depth follows frominput_chunk_length, kernel size and dilation base tcn_model.py. Changing the input length therefore changes the network's depth and receptive field silently. - Autoregression. Forecasting
nsteps withoutput_chunk_length=12runs autoregressive chunks tcn_model.py. The paper does not discuss this or any accuracy effect of it. - Sample cost. Probabilistic output is stored as samples in the
sampledimension §2.1 §2.5. The memory and time cost grows withn, components andnum_samples. This is an inference from the representation; the paper gives no measurements. - Dropout at inference. The TCN's dropout is documented as compatible with Monte Carlo dropout, enabled with
mc_dropout=Trueat prediction time tcn_model.py. The paper does not mention this option. - Learning rate. No learning rate is stated in the paper or the code default. It comes from torch's Adam default unless
optimizer_kwargsis set tcn_model.py. - Training cap.
max_samples_per_tslimits the training samples from each series by keeping the most recent ones torch_forecasting_model.py. This is a cap on the data used, not a change to the model.
Lineage
- Builds on: the TCN architecture the example uses §3 (the paper cites it as [tcn18] in the text). Darts itself builds on PyTorch and xarray §2.1 §2.3.
- Compared against: the paper names existing toolkits, including R's forecast package, Kats, sktime, Greykite, Merlion, GluonTS and PyTorch Forecasting §1. It does not give comparative results.
- Superseded by: not stated in this wiki.
Source and license
Adapted from “Darts: User-Friendly Modern Machine Learning for Time Series” by Julien Herzen, Francesco Lässig, Samuele Giuliano Piazzetta, Thomas Neuer, Léo Tafti, Guillaume Raille, Tomas Van Pottelbergh, Marek Pasieka, Andrzej Skrodzki, Nicolas Huguenin, Maxime Dumonal, Jan Kościsz, Dennis Bader, Frédérick Gusset, Mounir Benheddi, Camila Williamson, Michal Kosinski, Matej Petrik, Gaël Grosch (arXiv:2110.03224), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/unit8co/darts at commit 406ecda0ff7d (Apache-2.0). Any quoted code is shown under that license.