Skip to content

Commit 82e5003

Browse files
authored
Release 0.23.0 (#1440)
* Changelog update * Bump u8darts * update changelog * example AD image * Update readme * Update changelog link
1 parent 9c23beb commit 82e5003

File tree

4 files changed

+171
-27
lines changed

4 files changed

+171
-27
lines changed

CHANGELOG.md

+71-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,81 @@
11

22
# Changelog
33

4-
Darts is still in an early development phase, and we cannot always guarantee backwards compatibility. Changes that may **break code which uses a previous release of Darts** are marked with a "🔴".
4+
We do our best to avoid the introduction of breaking changes,
5+
but cannot always guarantee backwards compatibility. Changes that may **break code which uses a previous release of Darts** are marked with a "🔴".
56

67
## [Unreleased](https://github.com/unit8co/darts/tree/master)
7-
- Fixed edge case in ShapExplainer for regression models where covariates series > target series [#1310](https://https://github.com/unit8co/darts/pull/1310) by [Rijk van der Meulen](https://github.com/rijkvandermeulen)
8+
[Full Changelog](https://github.com/unit8co/darts/compare/0.23.0...master)
9+
10+
## [0.23.0](https://github.com/unit8co/darts/tree/0.23.0) (2022-12-23)
11+
### For users of the library:
12+
13+
**Improved**
14+
- 🚀🚀🚀 Brand new Darts module dedicated to anomaly detection on time series: `darts.ad`.
15+
More info on the API doc page: https://unit8co.github.io/darts/generated_api/darts.ad.html.
16+
[#1256](https://github.com/unit8co/darts/pull/1256) by [Julien Adda](https://github.com/julien12234)
17+
and [Julien Herzen](https://github.com/hrzn).
18+
- New forecasting models: `DLinearModel` and `NLinearModel` as proposed in [this paper](https://arxiv.org/pdf/2205.13504.pdf).
19+
[#1139](https://github.com/unit8co/darts/pull/1139) by [Julien Herzen](https://github.com/hrzn) and [Greg DeVos](https://github.com/gdevos010).
20+
- New forecasting model: `XGBModel` implementing XGBoost.
21+
[#1405](https://github.com/unit8co/darts/pull/1405) by [Julien Herzen](https://github.com/hrzn).
22+
- New `multi_models` option for all `RegressionModel`s: when set to False, uses only a single underlying
23+
estimator for multi-step forecasting, which can drastically increase computational efficiency.
24+
[#1291](https://github.com/unit8co/darts/pull/1291) by [Eliane Maalouf](https://github.com/eliane-maalouf).
25+
- All `RegressionModel`s (incl. LightGBM, Catboost, XGBoost, Random Forest, ...)
26+
now support static covariates.
27+
[#1412](https://github.com/unit8co/darts/pull/1412) by [Eliane Maalouf](https://github.com/eliane-maalouf).
28+
- `historical_forecasts()` and `backtest()` now work on multiple series, too.
29+
[#1318](https://github.com/unit8co/darts/pull/1318) by [Maxime Dumonal](https://github.com/dumjax).
30+
- New window transformation capabilities: `TimeSeries.window_transform()` and
31+
a new `WindowTransformer` which allow to easily create window features.
32+
[#1269](https://github.com/unit8co/darts/pull/1269) by [Eliane Maalouf](https://github.com/eliane-maalouf).
33+
- 🔴 Improvements to `TorchForecastingModels`: Load models directly to CPU that were trained on GPU. Save file size reduced.
34+
Improved PyTorch Lightning Trainer handling fixing several minor issues.
35+
Removed deprecated methods `load_model` and `save_model`
36+
[#1371](https://github.com/unit8co/darts/pull/1371) by [Dennis Bader](https://github.com/dennisbader).
37+
- Improvements to encoders: Added support for encoders to all models with covariate support through `add_encoders` at model creation.
38+
Encoders now generate the correct minimum required covariate time spans for all models.
39+
[#1338](https://github.com/unit8co/darts/pull/1338) by [Dennis Bader](https://github.com/dennisbader).
40+
- New datasets available in `darts.datasets` (`ILINetDataset`, `ExchangeRateDataset`, `TrafficDataset`, `WeatherDataset`)
41+
[#1298](https://github.com/unit8co/darts/pull/1298) by [Kamil Wierciak](https://github.com/FEJTWOW).
42+
[#1291](https://github.com/unit8co/darts/pull/1291) by [Eliane Maalouf](https://github.com/eliane-maalouf).
43+
- New `Diff` transformer, which can difference and "undifference" series
44+
[#1380](https://github.com/unit8co/darts/pull/1380) by [Matt Bilton](https://github.com/mabilton).
45+
- Improvements to KalmanForecaster: The model now accepts different TimeSeries for prediction than the ones used to fit the model.
46+
[#1338](https://github.com/unit8co/darts/pull/1338) by [Dennis Bader](https://github.com/dennisbader).
47+
- Backtest functions can now accept a list of metric functions [#1333](https://github.com/unit8co/darts/pull/1333)
48+
by [Antoine Madrona](https://github.com/madtoinou).
49+
- Extension of baseline models to work on multivariate series
50+
[#1373](https://github.com/unit8co/darts/pull/1373) by [Błażej Nowicki](https://github.com/BlazejNowicki).
51+
- Improvement to `TimeSeries.gaps()` [#1265](https://github.com/unit8co/darts/pull/1265) by
52+
[Antoine Madrona](https://github.com/madtoinou).
53+
- Speedup of `TimeSeries.quantile_timeseries()` method
54+
[#1351](https://github.com/unit8co/darts/pull/1351) by [@tranquilitysmile](https://github.com/tranquilitysmile).
55+
- Some dependencies which can be hard to install (LightGBM, Catboost, XGBoost, Prophet, Statsforecast)
56+
are not required anymore (if not installed the corresponding models will not be available)
57+
[#1360](https://github.com/unit8co/darts/pull/1360) by [Antoine Madrona](https://github.com/madtoinou).
858
- Removed `IPython` as a dependency. [#1331](https://github.com/unit8co/darts/pull/1331) by [Erik Hasse](https://github.com/erik-hasse)
9-
- New models: `DLinearModel` and `NLinearModel` as proposed in [this paper](https://arxiv.org/pdf/2205.13504.pdf). [#1139](https://github.com/unit8co/darts/pull/1139) by [Julien Herzen](https://github.com/hrzn) and [Greg DeVos](https://github.com/gdevos010).
10-
- 🔴 Improvements to `TorchForecastingModels`: Load models directly to CPU that were trained on GPU. Save file size reduced. Improved PyTorch Lightning Trainer handling fixing several minor issues. Removed deprecated methods `load_model` and `save_model` [#1371](https://github.com/unit8co/darts/pull/1371) by [Dennis Bader](https://github.com/dennisbader).
11-
- Improvements to encoders: Added support for encoders to all models with covariate support through `add_encoders` at model creation. Encoders now generate the correct minimum required covariate time spans for all models. [#1338](https://github.com/unit8co/darts/pull/1338) by [Dennis Bader](https://github.com/dennisbader).
12-
- Improvements to KalmanForecaster: The model now accepts different TimeSeries for prediction than the ones used to fit the model. [#1338](https://github.com/unit8co/darts/pull/1338) by [Dennis Bader](https://github.com/dennisbader).
59+
- Allow the creation of empty `TimeSeries` [#1359](https://github.com/unit8co/darts/pull/1359)
60+
by [Antoine Madrona](https://github.com/madtoinou).
1361

14-
[Full Changelog](https://github.com/unit8co/darts/compare/0.22.0...master)
62+
63+
64+
**Fixed**
65+
- Fixed edge case in ShapExplainer for regression models where covariates series > target series
66+
[#1310](https://https://github.com/unit8co/darts/pull/1310) by [Rijk van der Meulen](https://github.com/rijkvandermeulen)
67+
- Fixed a bug in `TimeSeries.resample()` [#1350](https://github.com/unit8co/darts/pull/1350)
68+
by [Antoine Madrona](https://github.com/madtoinou).
69+
- Fixed splitting methods when split point is not in the series
70+
[#1415](https://github.com/unit8co/darts/pull/1415) by [@DavidKleindienst](https://github.com/DavidKleindienst)
71+
- Fixed issues with `append_values()` and `prepend_values()` not correctly extending `RangeIndex`es
72+
[#1435](https://github.com/unit8co/darts/pull/1435) by [Matt Bilton](https://github.com/mabilton).
73+
- Fixed some issues with time zones [#1343](https://github.com/unit8co/darts/pull/1343)
74+
by [Antoine Madrona](https://github.com/madtoinou).
75+
- Fixed some issues when using a single target series with `RegressionEnsembleModel`
76+
[#1357](https://github.com/unit8co/darts/pull/1357) by [Dennis Bader](https://github.com/dennisbader).
77+
- Fixed treatment of stochastic models in ensemble models
78+
[#1423](https://github.com/unit8co/darts/pull/1423) by [Eliane Maalouf](https://github.com/eliane-maalouf).
1579

1680

1781
## [0.22.0](https://github.com/unit8co/darts/tree/0.22.0) (2022-10-04)

README.md

+99-19
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@
1414
[![codecov](https://codecov.io/gh/unit8co/darts/branch/master/graph/badge.svg?token=7F1TLUFHQW)](https://codecov.io/gh/unit8co/darts)
1515
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Join the chat at https://gitter.im/u8darts/darts](https://badges.gitter.im/u8darts/darts.svg)](https://gitter.im/u8darts/darts?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1616

17-
**darts** is a Python library for easy manipulation and forecasting of time series.
18-
It contains a variety of models, from classics such as ARIMA to deep neural networks.
19-
The models can all be used in the same way, using `fit()` and `predict()` functions,
20-
similar to scikit-learn. The library also makes it easy to backtest models,
17+
**Darts** is a Python library for user-friendly forecasting and anomaly detection
18+
on time series. It contains a variety of models, from classics such as ARIMA to
19+
deep neural networks. The forecasting models can all be used in the same way,
20+
using `fit()` and `predict()` functions, similar to scikit-learn.
21+
The library also makes it easy to backtest models,
2122
combine the predictions of several models, and take external data into account.
2223
Darts supports both univariate and multivariate time series and models.
2324
The ML-based models can be trained on potentially large datasets containing multiple time
2425
series, and some of the models offer a rich support for probabilistic forecasting.
2526

27+
Darts also offers extensive anomaly detection capabilities.
28+
For instance, it is trivial to apply PyOD models on time series to obtain anomaly scores,
29+
or to wrap any of Darts forecasting or filtering models to obtain fully
30+
fledged anomaly detection models.
31+
32+
2633
## Documentation
2734
* [Quickstart](https://unit8co.github.io/darts/quickstart/00-quickstart.html)
2835
* [User Guide](https://unit8co.github.io/darts/userguide.html)
@@ -57,6 +64,8 @@ For more details you can refer to our
5764

5865
## Example Usage
5966

67+
### Forecasting
68+
6069
Create a `TimeSeries` object from a Pandas DataFrame, and split it in train/validation series:
6170

6271
```python
@@ -95,43 +104,113 @@ plt.legend()
95104
<img src="https://github.com/unit8co/darts/raw/master/static/images/example.png" alt="darts forecast example" />
96105
</div>
97106

107+
### Anomaly Detection
108+
109+
Load a multivariate series, trim it, keep 2 components, split train and validation sets:
110+
111+
```python
112+
from darts.datasets import ETTh2Dataset
113+
114+
series = ETTh2Dataset().load()[:10000][["MUFL", "LULL"]]
115+
train, val = series.split_before(0.6)
116+
```
117+
118+
Build a k-means anomaly scorer, train it on the train set
119+
and use it on the validation set to get anomaly scores:
120+
121+
```python
122+
from darts.ad import KMeansScorer
123+
124+
scorer = KMeansScorer(k=2, window=5)
125+
scorer.fit(train)
126+
anom_score = scorer.score(val)
127+
```
128+
129+
Build a binary anomaly detector and train it over train scores,
130+
then use it over validation scores to get binary anomaly classification:
131+
132+
```python
133+
from darts.ad import QuantileDetector
134+
135+
detector = QuantileDetector(high_quantile=0.99)
136+
detector.fit(scorer.score(train))
137+
binary_anom = detector.detect(anom_score)
138+
```
139+
140+
Plot (shifting and scaling some of the series
141+
to make everything appear on the same figure):
142+
143+
```python
144+
import matplotlib.pyplot as plt
145+
146+
series.plot()
147+
(anom_score / 2. - 100).plot(label="computed anomaly score", c="orangered", lw=3)
148+
(binary_anom * 45 - 150).plot(label="detected binary anomaly", lw=4)
149+
```
150+
151+
<div style="text-align:center;">
152+
<img src="https://github.com/unit8co/darts/raw/master/static/images/example_ad.png" alt="darts anomaly detection example" />
153+
</div>
154+
155+
98156
## Features
99157
* **Forecasting Models:** A large collection of forecasting models; from statistical models (such as
100158
ARIMA) to deep learning models (such as N-BEATS). See [table of models below](#forecasting-models).
159+
160+
* **Anomaly Detection** The `darts.ad` module contains a collection of anomaly scorers,
161+
detectors and aggregators, which can all be combined to detect anomalies in time series.
162+
It is easy to wrap any of Darts forecasting or filtering models to build
163+
a fully fledged anomaly detection model that compares predictions with actuals.
164+
The `PyODScorer` makes it trivial to use PyOD detectors on time series.
165+
101166
* **Multivariate Support:** `TimeSeries` can be multivariate - i.e., contain multiple time-varying
102167
dimensions instead of a single scalar value. Many models can consume and produce multivariate series.
103-
* **Multiple series training:** All machine learning based models (incl. all neural networks)
104-
support being trained on multiple (potentially multivariate) series. This can scale to large datasets.
168+
169+
* **Multiple series training (global models):** All machine learning based models (incl. all neural networks)
170+
support being trained on multiple (potentially multivariate) series. This can scale to large datasets too.
171+
105172
* **Probabilistic Support:** `TimeSeries` objects can (optionally) represent stochastic
106-
time series; this can for instance be used to get confidence intervals, and many models support different flavours of probabilistic forecasting (such as estimating parametric distributions
107-
or quantiles).
173+
time series; this can for instance be used to get confidence intervals, and many models support different
174+
flavours of probabilistic forecasting (such as estimating parametric distributions or quantiles).
175+
Some anomaly detection scorers are also able to exploit these predictive distributions.
176+
108177
* **Past and Future Covariates support:** Many models in Darts support past-observed and/or future-known
109178
covariate (external data) time series as inputs for producing forecasts.
179+
110180
* **Static Covariates support:** In addition to time-dependent data, `TimeSeries` can also contain
111181
static data for each dimension, which can be exploited by some models.
182+
112183
* **Hierarchical Reconciliation:** Darts offers transformers to perform reconciliation.
113184
These can make the forecasts add up in a way that respects the underlying hierarchy.
185+
114186
* **Regression Models:** It is possible to plug-in any scikit-learn compatible model
115187
to obtain forecasts as functions of lagged values of the target series and covariates.
116-
* **Explainability:** Darts has the ability to *explain* forecasting models by using Shap values.
188+
189+
* **Explainability:** Darts has the ability to *explain* some forecasting models using Shap values.
190+
117191
* **Data processing:** Tools to easily apply (and revert) common transformations on
118-
time series data (scaling, filling missing values, boxcox, ...)
192+
time series data (scaling, filling missing values, differencing, boxcox, ...)
193+
119194
* **Metrics:** A variety of metrics for evaluating time series' goodness of fit;
120195
from R2-scores to Mean Absolute Scaled Error.
196+
121197
* **Backtesting:** Utilities for simulating historical forecasts, using moving time windows.
198+
122199
* **PyTorch Lightning Support:** All deep learning models are implemented using PyTorch Lightning,
123200
supporting among other things custom callbacks, GPUs/TPUs training and custom trainers.
201+
124202
* **Filtering Models:** Darts offers three filtering models: `KalmanFilter`, `GaussianProcessFilter`,
125203
and `MovingAverage`, which allow to filter time series, and in some cases obtain probabilistic
126204
inferences of the underlying states/values.
205+
127206
* **Datasets** The `darts.datasets` submodule contains some popular time series datasets for rapid
128-
experimentation.
207+
and reproducible experimentation.
129208

130209
## Forecasting Models
131210
Here's a breakdown of the forecasting models currently implemented in Darts. We are constantly working
132211
on bringing more models and features.
133212

134-
Model | Univariate | Multivariate | Probabilistic | Multiple-series training | Past-observed covariates support | Future-known covariates | Static covariates support | Reference
213+
Model | Univariate | Multivariate | Probabilistic | Multiple series (global) | Past-observed covariates | Future-known covariates | Static covariates | Reference
135214
--- | --- | --- | --- | --- | --- | --- | --- | ---
136215
`ARIMA` | ✅ | | ✅ | | | ✅ | |
137216
`VARIMA` | ✅ | ✅ | | | | ✅ | |
@@ -145,20 +224,21 @@ Model | Univariate | Multivariate | Probabilistic | Multiple-series training | P
145224
`FFT` (Fast Fourier Transform) | ✅ | | | | | | |
146225
`KalmanForecaster` using the Kalman filter and N4SID for system identification | ✅ | ✅ | ✅ | | | ✅ | | [N4SID paper](https://people.duke.edu/~hpgavin/SystemID/References/VanOverschee-Automatica-1994.pdf)
147226
`Croston` method | ✅ | | | | | | |
148-
`RegressionModel`; generic wrapper around any sklearn regression model | ✅ | ✅ | | ✅ | ✅ | ✅ | |
149-
`RandomForest` | ✅ | ✅ | | ✅ | ✅ | ✅ | |
150-
`LinearRegressionModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
151-
`LightGBMModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
152-
`CatBoostModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
227+
`RegressionModel`; generic wrapper around any sklearn regression model | ✅ | ✅ | | ✅ | ✅ | ✅ | ✅ |
228+
`RandomForest` | ✅ | ✅ | | ✅ | ✅ | ✅ | ✅ |
229+
`LinearRegressionModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
230+
`LightGBMModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
231+
`CatBoostModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
232+
`XGBModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
153233
`RNNModel` (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version | ✅ | ✅ | ✅ | ✅ | | ✅ | | [DeepAR paper](https://arxiv.org/abs/1704.04110)
154234
`BlockRNNModel` (incl. LSTM and GRU) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
155235
`NBEATSModel` | ✅ | ✅ | ✅ | ✅ | ✅ | | | [N-BEATS paper](https://arxiv.org/abs/1905.10437)
156236
`NHiTSModel` | ✅ | ✅ | ✅ | ✅ | ✅ | | | [N-HiTS paper](https://arxiv.org/abs/2201.12886)
157237
`TCNModel` | ✅ | ✅ | ✅ | ✅ | ✅ | | | [TCN paper](https://arxiv.org/abs/1803.01271), [DeepTCN paper](https://arxiv.org/abs/1906.04397), [blog post](https://medium.com/unit8-machine-learning-publication/temporal-convolutional-networks-and-forecasting-5ce1b6e97ce4)
158238
`TransformerModel` | ✅ | ✅ | ✅ | ✅ | ✅ | | |
159239
`TFTModel` (Temporal Fusion Transformer) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | [TFT paper](https://arxiv.org/pdf/1912.09363.pdf), [PyTorch Forecasting](https://pytorch-forecasting.readthedocs.io/en/latest/models.html)
160-
`DLinearModel` (coming in v0.23.0)| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | [DLinear paper](https://arxiv.org/pdf/2205.13504.pdf), [Cure Lab](https://github.com/cure-lab/LTSF-Linear)
161-
`NLinearModel` (coming in v0.23.0)| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | [NLinear paper](https://arxiv.org/pdf/2205.13504.pdf), [Cure Lab](https://github.com/cure-lab/LTSF-Linear)
240+
`DLinearModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | [DLinear paper](https://arxiv.org/pdf/2205.13504.pdf)
241+
`NLinearModel` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | [NLinear paper](https://arxiv.org/pdf/2205.13504.pdf)
162242
Naive Baselines | ✅ | ✅ | | | | | |
163243

164244

setup_u8darts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def read_requirements(path):
2828

2929
setup(
3030
name="u8darts",
31-
version="0.22.0",
31+
version="0.23.0",
3232
description="A python library for easy manipulation and forecasting of time series.",
3333
long_description=LONG_DESCRIPTION,
3434
long_description_content_type="text/markdown",

static/images/example_ad.png

45.6 KB
Loading

0 commit comments

Comments
 (0)