diff --git a/README.html b/README.html index 7d5d23ddc1..43af25ca2f 100644 --- a/README.html +++ b/README.html @@ -35,7 +35,7 @@ - + @@ -463,31 +463,31 @@

Forecasting Models

NaiveMean

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

NaiveSeasonal

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

NaiveDrift

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

NaiveMovingAverage

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

Statistical / Classic Models
(LocalForecastingModel)

@@ -498,101 +498,101 @@

Forecasting Models

ARIMA

-

🟩 πŸŸ₯

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ βœ… πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

VARIMA

-

πŸŸ₯ 🟩

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

πŸ”΄ βœ…

+

πŸ”΄ βœ… πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

AutoARIMA

-

🟩 πŸŸ₯

-

πŸŸ₯ 🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ βœ… πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

StatsForecastAutoArima (faster AutoARIMA)

Nixtla’s statsforecast

-

🟩 πŸŸ₯

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ βœ… πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

ExponentialSmoothing

-

🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

StatsforecastAutoETS

Nixtla’s statsforecast

-

🟩 πŸŸ₯

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ βœ… πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

StatsforecastAutoCES

Nixtla’s statsforecast

-

🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

BATS and TBATS

TBATS paper

-

🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

Theta and FourTheta

Theta & 4 Theta

-

🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

StatsForecastAutoTheta

Nixtla’s statsforecast

-

🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

Prophet

Prophet repo

-

🟩 πŸŸ₯

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ βœ… πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

FFT (Fast Fourier Transform)

-

🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

KalmanForecaster using the Kalman filter and N4SID for system identification

N4SID paper

-

🟩 🟩

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 πŸŸ₯

-

πŸŸ₯

+

βœ… βœ…

+

πŸ”΄ βœ… πŸ”΄

+

βœ… πŸ”΄

+

πŸ”΄

Croston method

-

🟩 πŸŸ₯

-

πŸŸ₯ 🟩 πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

πŸŸ₯

+

βœ… πŸ”΄

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

πŸ”΄

Global Baseline Models
(GlobalForecastingModel)

@@ -603,24 +603,24 @@

Forecasting Models

GlobalNaiveAggregate

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

🟩

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

βœ…

GlobalNaiveDrift

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

🟩

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

βœ…

GlobalNaiveSeasonal

-

🟩 🟩

-

πŸŸ₯ πŸŸ₯ πŸŸ₯

-

πŸŸ₯ πŸŸ₯

-

🟩

+

βœ… βœ…

+

πŸ”΄ πŸ”΄ πŸ”΄

+

πŸ”΄ πŸ”΄

+

βœ…

Regression Models
(GlobalForecastingModel)

@@ -631,45 +631,45 @@

Forecasting Models

RegressionModel: generic wrapper around any sklearn regression model

-

🟩 🟩

-

🟩 🟩 🟩

-

πŸŸ₯ πŸŸ₯

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

πŸ”΄ πŸ”΄

+

βœ…

LinearRegressionModel

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

RandomForest

-

🟩 🟩

-

🟩 🟩 🟩

-

πŸŸ₯ πŸŸ₯

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

πŸ”΄ πŸ”΄

+

βœ…

LightGBMModel

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

XGBModel

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

CatBoostModel

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

PyTorch (Lightning)-based Models
(GlobalForecastingModel)

@@ -680,80 +680,80 @@

Forecasting Models

RNNModel (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version

DeepAR paper

-

🟩 🟩

-

πŸŸ₯ 🟩 πŸŸ₯

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

πŸ”΄ βœ… πŸ”΄

+

βœ… βœ…

+

βœ…

BlockRNNModel (incl. LSTM and GRU)

-

🟩 🟩

-

🟩 πŸŸ₯ πŸŸ₯

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… πŸ”΄ πŸ”΄

+

βœ… βœ…

+

βœ…

NBEATSModel

N-BEATS paper

-

🟩 🟩

-

🟩 πŸŸ₯ πŸŸ₯

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… πŸ”΄ πŸ”΄

+

βœ… βœ…

+

βœ…

NHiTSModel

N-HiTS paper

-

🟩 🟩

-

🟩 πŸŸ₯ πŸŸ₯

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… πŸ”΄ πŸ”΄

+

βœ… βœ…

+

βœ…

TCNModel

TCN paper, DeepTCN paper, blog post

-

🟩 🟩

-

🟩 πŸŸ₯ πŸŸ₯

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… πŸ”΄ πŸ”΄

+

βœ… βœ…

+

βœ…

TransformerModel

-

🟩 🟩

-

🟩 πŸŸ₯ πŸŸ₯

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… πŸ”΄ πŸ”΄

+

βœ… βœ…

+

βœ…

TFTModel (Temporal Fusion Transformer)

TFT paper, PyTorch Forecasting

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

DLinearModel

DLinear paper

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

NLinearModel

NLinear paper

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

TiDEModel

TiDE paper

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

TSMixerModel

TSMixer paper, PyTorch Implementation

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

Ensemble Models
(GlobalForecastingModel): Model support is dependent on ensembled forecasting models and the ensemble model itself

@@ -764,17 +764,17 @@

Forecasting Models

NaiveEnsembleModel

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

RegressionEnsembleModel

-

🟩 🟩

-

🟩 🟩 🟩

-

🟩 🟩

-

🟩

+

βœ… βœ…

+

βœ… βœ… βœ…

+

βœ… βœ…

+

βœ…

diff --git a/_modules/darts/ad/aggregators/aggregators.html b/_modules/darts/ad/aggregators/aggregators.html index e45b585303..9abf16ddc9 100644 --- a/_modules/darts/ad/aggregators/aggregators.html +++ b/_modules/darts/ad/aggregators/aggregators.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/aggregators/and_aggregator.html b/_modules/darts/ad/aggregators/and_aggregator.html index 32cea6bf96..b19a3d2289 100644 --- a/_modules/darts/ad/aggregators/and_aggregator.html +++ b/_modules/darts/ad/aggregators/and_aggregator.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/aggregators/ensemble_sklearn_aggregator.html b/_modules/darts/ad/aggregators/ensemble_sklearn_aggregator.html index 04525956a5..9abe9c3a0e 100644 --- a/_modules/darts/ad/aggregators/ensemble_sklearn_aggregator.html +++ b/_modules/darts/ad/aggregators/ensemble_sklearn_aggregator.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/aggregators/or_aggregator.html b/_modules/darts/ad/aggregators/or_aggregator.html index a2016e0a53..126b4cc7dc 100644 --- a/_modules/darts/ad/aggregators/or_aggregator.html +++ b/_modules/darts/ad/aggregators/or_aggregator.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/anomaly_model/filtering_am.html b/_modules/darts/ad/anomaly_model/filtering_am.html index 51473cb760..4496534287 100644 --- a/_modules/darts/ad/anomaly_model/filtering_am.html +++ b/_modules/darts/ad/anomaly_model/filtering_am.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/anomaly_model/forecasting_am.html b/_modules/darts/ad/anomaly_model/forecasting_am.html index f24b05ac55..d32a157956 100644 --- a/_modules/darts/ad/anomaly_model/forecasting_am.html +++ b/_modules/darts/ad/anomaly_model/forecasting_am.html @@ -34,7 +34,7 @@ - + @@ -307,6 +307,7 @@

Source code for darts.ad.anomaly_model.forecasting_am

`train_length`. enable_optimization Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. model_fit_kwargs Parameters to be passed on to the forecast model `fit()` method. @@ -387,6 +388,7 @@

Source code for darts.ad.anomaly_model.forecasting_am

`train_length`. enable_optimization Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. return_model_prediction Whether to return the forecasting model prediction along with the anomaly scores. @@ -474,6 +476,7 @@

Source code for darts.ad.anomaly_model.forecasting_am

`train_length`. enable_optimization Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. Returns ------- @@ -569,6 +572,7 @@

Source code for darts.ad.anomaly_model.forecasting_am

`train_length`. enable_optimization Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. metric The name of the metric function to use. Must be one of "AUC_ROC" (Area Under the Receiver Operating Characteristic Curve) and "AUC_PR" (Average Precision from scores). @@ -674,6 +678,7 @@

Source code for darts.ad.anomaly_model.forecasting_am

`train_length`. enable_optimization Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. anomalies The ground truth of the anomalies (1 if it is an anomaly and 0 if not). names_of_scorers diff --git a/_modules/darts/ad/detectors/detectors.html b/_modules/darts/ad/detectors/detectors.html index 46cc75d01f..bf21ed59d5 100644 --- a/_modules/darts/ad/detectors/detectors.html +++ b/_modules/darts/ad/detectors/detectors.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/detectors/iqr_detector.html b/_modules/darts/ad/detectors/iqr_detector.html new file mode 100644 index 0000000000..9a56fdca72 --- /dev/null +++ b/_modules/darts/ad/detectors/iqr_detector.html @@ -0,0 +1,291 @@ + + + + + + + + darts.ad.detectors.iqr_detector — darts documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+ + + + +
+ +
+ + + + + + +
+ +
+ +

Source code for darts.ad.detectors.iqr_detector

+"""
+Interquartile Range (IQR) Detector
+-----------------
+
+Flags anomalies that are beyond the IQR (between the third and the first quartile)
+of historical data by some factor of it's difference (typically 1.5).
+This is similar to a threshold-based detector, but the thresholds are
+computed as distances from the IQR of historical data when the detector is fitted.
+"""
+
+from typing import Sequence, Union
+
+import numpy as np
+
+from darts.ad.detectors.quantile_detector import QuantileDetector
+from darts.ad.detectors.threshold_detector import ThresholdDetector
+from darts.logging import get_logger, raise_log
+from darts.timeseries import TimeSeries
+
+logger = get_logger(__name__)
+
+
+
[docs]class IQRDetector(QuantileDetector): + def __init__(self, scale: Union[Sequence[float], float] = 1.5) -> None: + """IQR Detector + + Flags values that lie outside of the interquartile range (IQR) + by more than a certain factor of IQR's value as anomalies. + The factor is passed in the `scale` parameter. + + If a single value is provided for `scale`, + this same value will be used across all components of the series. + + If a sequences of values is given for the `scale` parameter, + it's length must match the dimensionality of the series passed. + + Parameters + ---------- + scale + (Sequence of) scale(s) used to indicate what distance from the IQR constitutes an anomaly. + Defaults to `1.5`. Must be non-negative. If a sequence, must match the dimensionality of the series + this detector is applied to. + """ + + # Parent QuantileDetector will compute Q1 and Q3 thresholds + super().__init__(low_quantile=0.25, high_quantile=0.75) + + self.scale = np.array(scale) + if self.scale.ndim == 0: + self.scale = np.expand_dims(self.scale, 0) + + if not np.issubdtype(self.scale.dtype, np.number) or (self.scale < 0.0).any(): + raise_log( + ValueError("All values in `scale` must be non-negative numbers."), + logger=logger, + ) + + def _fit_core(self, series: Sequence[TimeSeries]) -> None: + super()._fit_core(series) + + if len(self.scale) > 1 and len(self.scale) != series[0].width: + raise_log( + ValueError( + "The number of components of input must be equal to the number " + "of values given for `scale`. Found number of components " + f"equal to {series[0].width} and expected {len(self.scale)}." + ), + logger=logger, + ) + + low_threshold = np.array(self.detector.low_threshold) + high_threshold = np.array(self.detector.high_threshold) + + IQR = high_threshold - low_threshold + + low_threshold -= self.scale * IQR + high_threshold += self.scale * IQR + + self.detector = ThresholdDetector( + low_threshold=list(low_threshold), high_threshold=list(high_threshold) + )
+
+ +
+ + + +
+
+ +
+ + +
+
+ + +
+
+ + + + + +
+
+ + \ No newline at end of file diff --git a/_modules/darts/ad/detectors/quantile_detector.html b/_modules/darts/ad/detectors/quantile_detector.html index 266082457e..b9e711520b 100644 --- a/_modules/darts/ad/detectors/quantile_detector.html +++ b/_modules/darts/ad/detectors/quantile_detector.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/detectors/threshold_detector.html b/_modules/darts/ad/detectors/threshold_detector.html index 6be282f305..b40540f86f 100644 --- a/_modules/darts/ad/detectors/threshold_detector.html +++ b/_modules/darts/ad/detectors/threshold_detector.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/difference_scorer.html b/_modules/darts/ad/scorers/difference_scorer.html index 4bddf233c9..1816318f09 100644 --- a/_modules/darts/ad/scorers/difference_scorer.html +++ b/_modules/darts/ad/scorers/difference_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/kmeans_scorer.html b/_modules/darts/ad/scorers/kmeans_scorer.html index 68b09fa6f8..6c952b265e 100644 --- a/_modules/darts/ad/scorers/kmeans_scorer.html +++ b/_modules/darts/ad/scorers/kmeans_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/nll_cauchy_scorer.html b/_modules/darts/ad/scorers/nll_cauchy_scorer.html index 5089d158ad..5a12241531 100644 --- a/_modules/darts/ad/scorers/nll_cauchy_scorer.html +++ b/_modules/darts/ad/scorers/nll_cauchy_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/nll_exponential_scorer.html b/_modules/darts/ad/scorers/nll_exponential_scorer.html index e9ba60dd39..25488f2adb 100644 --- a/_modules/darts/ad/scorers/nll_exponential_scorer.html +++ b/_modules/darts/ad/scorers/nll_exponential_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/nll_gamma_scorer.html b/_modules/darts/ad/scorers/nll_gamma_scorer.html index 5cd8a9e65b..ee4bcdbb55 100644 --- a/_modules/darts/ad/scorers/nll_gamma_scorer.html +++ b/_modules/darts/ad/scorers/nll_gamma_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/nll_gaussian_scorer.html b/_modules/darts/ad/scorers/nll_gaussian_scorer.html index e79fef5031..5e9f1ddf66 100644 --- a/_modules/darts/ad/scorers/nll_gaussian_scorer.html +++ b/_modules/darts/ad/scorers/nll_gaussian_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/nll_laplace_scorer.html b/_modules/darts/ad/scorers/nll_laplace_scorer.html index e314042e02..fe84696829 100644 --- a/_modules/darts/ad/scorers/nll_laplace_scorer.html +++ b/_modules/darts/ad/scorers/nll_laplace_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/nll_poisson_scorer.html b/_modules/darts/ad/scorers/nll_poisson_scorer.html index c19b80967b..605f13d313 100644 --- a/_modules/darts/ad/scorers/nll_poisson_scorer.html +++ b/_modules/darts/ad/scorers/nll_poisson_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/norm_scorer.html b/_modules/darts/ad/scorers/norm_scorer.html index ed96a5f1f9..dc0df4feac 100644 --- a/_modules/darts/ad/scorers/norm_scorer.html +++ b/_modules/darts/ad/scorers/norm_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/pyod_scorer.html b/_modules/darts/ad/scorers/pyod_scorer.html index fd88ee1372..51040e1c4d 100644 --- a/_modules/darts/ad/scorers/pyod_scorer.html +++ b/_modules/darts/ad/scorers/pyod_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/scorers.html b/_modules/darts/ad/scorers/scorers.html index b6eff588ed..d72cd46161 100644 --- a/_modules/darts/ad/scorers/scorers.html +++ b/_modules/darts/ad/scorers/scorers.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/scorers/wasserstein_scorer.html b/_modules/darts/ad/scorers/wasserstein_scorer.html index 1b93ce0c93..26e0148fa2 100644 --- a/_modules/darts/ad/scorers/wasserstein_scorer.html +++ b/_modules/darts/ad/scorers/wasserstein_scorer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/ad/utils.html b/_modules/darts/ad/utils.html index ccb835d567..fd607e2139 100644 --- a/_modules/darts/ad/utils.html +++ b/_modules/darts/ad/utils.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/dtw/cost_matrix.html b/_modules/darts/dataprocessing/dtw/cost_matrix.html index 9bfef71617..bfd3d1e993 100644 --- a/_modules/darts/dataprocessing/dtw/cost_matrix.html +++ b/_modules/darts/dataprocessing/dtw/cost_matrix.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/dtw/dtw.html b/_modules/darts/dataprocessing/dtw/dtw.html index f8c8b9a583..f5c99be7f9 100644 --- a/_modules/darts/dataprocessing/dtw/dtw.html +++ b/_modules/darts/dataprocessing/dtw/dtw.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/dtw/window.html b/_modules/darts/dataprocessing/dtw/window.html index 0ac76ea76d..e7dca46468 100644 --- a/_modules/darts/dataprocessing/dtw/window.html +++ b/_modules/darts/dataprocessing/dtw/window.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/encoders/encoder_base.html b/_modules/darts/dataprocessing/encoders/encoder_base.html index d262d63ce9..dd72b22db4 100644 --- a/_modules/darts/dataprocessing/encoders/encoder_base.html +++ b/_modules/darts/dataprocessing/encoders/encoder_base.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/encoders/encoders.html b/_modules/darts/dataprocessing/encoders/encoders.html index c547815c85..c3f18f5a41 100644 --- a/_modules/darts/dataprocessing/encoders/encoders.html +++ b/_modules/darts/dataprocessing/encoders/encoders.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/pipeline.html b/_modules/darts/dataprocessing/pipeline.html index 33153a9620..b8f38dd33c 100644 --- a/_modules/darts/dataprocessing/pipeline.html +++ b/_modules/darts/dataprocessing/pipeline.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/base_data_transformer.html b/_modules/darts/dataprocessing/transformers/base_data_transformer.html index fc2107f776..2d1dc3c170 100644 --- a/_modules/darts/dataprocessing/transformers/base_data_transformer.html +++ b/_modules/darts/dataprocessing/transformers/base_data_transformer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/boxcox.html b/_modules/darts/dataprocessing/transformers/boxcox.html index c38ec27a87..cd8ac91989 100644 --- a/_modules/darts/dataprocessing/transformers/boxcox.html +++ b/_modules/darts/dataprocessing/transformers/boxcox.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/diff.html b/_modules/darts/dataprocessing/transformers/diff.html index 29953bc890..f10a3e43ce 100644 --- a/_modules/darts/dataprocessing/transformers/diff.html +++ b/_modules/darts/dataprocessing/transformers/diff.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/fittable_data_transformer.html b/_modules/darts/dataprocessing/transformers/fittable_data_transformer.html index b1761b8521..56b831f35f 100644 --- a/_modules/darts/dataprocessing/transformers/fittable_data_transformer.html +++ b/_modules/darts/dataprocessing/transformers/fittable_data_transformer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/invertible_data_transformer.html b/_modules/darts/dataprocessing/transformers/invertible_data_transformer.html index 139a0b5221..289dc605b1 100644 --- a/_modules/darts/dataprocessing/transformers/invertible_data_transformer.html +++ b/_modules/darts/dataprocessing/transformers/invertible_data_transformer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/mappers.html b/_modules/darts/dataprocessing/transformers/mappers.html index f6daa486b2..5c88405c83 100644 --- a/_modules/darts/dataprocessing/transformers/mappers.html +++ b/_modules/darts/dataprocessing/transformers/mappers.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/midas.html b/_modules/darts/dataprocessing/transformers/midas.html index 70feb4b223..67604dd6d0 100644 --- a/_modules/darts/dataprocessing/transformers/midas.html +++ b/_modules/darts/dataprocessing/transformers/midas.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/missing_values_filler.html b/_modules/darts/dataprocessing/transformers/missing_values_filler.html index 498042181f..b98c2ff1b5 100644 --- a/_modules/darts/dataprocessing/transformers/missing_values_filler.html +++ b/_modules/darts/dataprocessing/transformers/missing_values_filler.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/reconciliation.html b/_modules/darts/dataprocessing/transformers/reconciliation.html index 10e80101e2..b9ce8d48dc 100644 --- a/_modules/darts/dataprocessing/transformers/reconciliation.html +++ b/_modules/darts/dataprocessing/transformers/reconciliation.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/scaler.html b/_modules/darts/dataprocessing/transformers/scaler.html index c1131a8691..74fcde7ea1 100644 --- a/_modules/darts/dataprocessing/transformers/scaler.html +++ b/_modules/darts/dataprocessing/transformers/scaler.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/static_covariates_transformer.html b/_modules/darts/dataprocessing/transformers/static_covariates_transformer.html index 623da7d11e..4467a048d1 100644 --- a/_modules/darts/dataprocessing/transformers/static_covariates_transformer.html +++ b/_modules/darts/dataprocessing/transformers/static_covariates_transformer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/dataprocessing/transformers/window_transformer.html b/_modules/darts/dataprocessing/transformers/window_transformer.html index ee4128547a..10bacd32d6 100644 --- a/_modules/darts/dataprocessing/transformers/window_transformer.html +++ b/_modules/darts/dataprocessing/transformers/window_transformer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/datasets.html b/_modules/darts/datasets.html index 23de7d46f0..0de3bb7fe9 100644 --- a/_modules/darts/datasets.html +++ b/_modules/darts/datasets.html @@ -34,7 +34,7 @@ - + @@ -747,8 +747,8 @@

Source code for darts.datasets

 
             # filter column down to the period of recording
             srs = srs.replace(0.0, np.nan)
-            start_date = min(srs.fillna(method="ffill").dropna().index)
-            end_date = max(srs.fillna(method="bfill").dropna().index)
+            start_date = min(srs.ffill().dropna().index)
+            end_date = max(srs.bfill().dropna().index)
             active_range = (srs.index >= start_date) & (srs.index <= end_date)
             srs = srs[active_range].fillna(0.0)
 
@@ -845,8 +845,8 @@ 

Source code for darts.datasets

             srs = series[label]
 
             # filter column down to the period of recording
-            start_date = min(srs.fillna(method="ffill").dropna().index)
-            end_date = max(srs.fillna(method="bfill").dropna().index)
+            start_date = min(srs.ffill().dropna().index)
+            end_date = max(srs.bfill().dropna().index)
             active_range = (srs.index >= start_date) & (srs.index <= end_date)
             srs = srs[active_range]
 
diff --git a/_modules/darts/datasets/dataset_loaders.html b/_modules/darts/datasets/dataset_loaders.html
index 44504864a8..dd13fbb3d4 100644
--- a/_modules/darts/datasets/dataset_loaders.html
+++ b/_modules/darts/datasets/dataset_loaders.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/explainability/explainability_result.html b/_modules/darts/explainability/explainability_result.html
index efa26767c6..1826c8eeb1 100644
--- a/_modules/darts/explainability/explainability_result.html
+++ b/_modules/darts/explainability/explainability_result.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/explainability/shap_explainer.html b/_modules/darts/explainability/shap_explainer.html
index 10bca2742a..8bf75152fa 100644
--- a/_modules/darts/explainability/shap_explainer.html
+++ b/_modules/darts/explainability/shap_explainer.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
@@ -833,7 +833,7 @@ 

Source code for darts.explainability.shap_explainer

shap_explanation_tmp = self.explainers(foreground_X) for h in horizons: tmp_n = {} - for t_idx, t in enumerate(target_components): + for t_idx, t in enumerate(self.target_components): if t not in target_components: continue if not self.single_output: diff --git a/_modules/darts/explainability/tft_explainer.html b/_modules/darts/explainability/tft_explainer.html index 200576e4dd..33866c9a00 100644 --- a/_modules/darts/explainability/tft_explainer.html +++ b/_modules/darts/explainability/tft_explainer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/explainability/utils.html b/_modules/darts/explainability/utils.html index 68bac8b332..832e5959ca 100644 --- a/_modules/darts/explainability/utils.html +++ b/_modules/darts/explainability/utils.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/metrics/metrics.html b/_modules/darts/metrics/metrics.html index a995c0ac94..225b58fc58 100644 --- a/_modules/darts/metrics/metrics.html +++ b/_modules/darts/metrics/metrics.html @@ -34,7 +34,7 @@ - + @@ -183,19 +183,27 @@

Source code for darts.metrics.metrics

 import inspect
 from functools import wraps
 from inspect import signature
-from typing import Callable, List, Optional, Sequence, Tuple, Union
+from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
 
 import numpy as np
+import pandas as pd
 
 from darts import TimeSeries
 from darts.dataprocessing import dtw
 from darts.logging import get_logger, raise_log
-from darts.utils import _build_tqdm_iterator, _parallel_apply, n_steps_between
 from darts.utils.ts_utils import SeriesType, get_series_seq_type, series2seq
+from darts.utils.utils import (
+    _build_tqdm_iterator,
+    _parallel_apply,
+    likelihood_component_names,
+    n_steps_between,
+    quantile_names,
+)
 
 logger = get_logger(__name__)
 TIME_AX = 0
 COMP_AX = 1
+SMPL_AX = 2
 
 # Note: for new metrics added to this module to be able to leverage the two decorators, it is required both having
 # the `actual_series` and `pred_series` parameters, and not having other ``Sequence`` as args (since these decorators
@@ -208,6 +216,51 @@ 

Source code for darts.metrics.metrics

 ]
 
 
+
[docs]def interval_support(func) -> Callable[..., METRIC_OUTPUT_TYPE]: + """ + This decorator adds support for quantile interval metrics with sanity checks, processing, and extraction of + quantiles from the intervals. + """ + + @wraps(func) + def wrapper_interval_support(*args, **kwargs): + q = kwargs.get("q") + if q is not None: + raise_log( + ValueError( + "`q` is not supported for quantile interval metrics; use `q_interval` instead." + ) + ) + q_interval = kwargs.get("q_interval") + if q_interval is None: + raise_log( + ValueError("Quantile interval metrics require setting `q_interval`.") + ) + if isinstance(q_interval, tuple): + q_interval = [q_interval] + q_interval = np.array(q_interval) + if not q_interval.ndim == 2 or q_interval.shape[1] != 2: + raise_log( + ValueError( + "`q_interval` must be a tuple (float, float) or a sequence of tuples (float, float)." + ), + logger=logger, + ) + if not np.all(q_interval[:, 1] - q_interval[:, 0] > 0): + raise_log( + ValueError( + "all intervals in `q_interval` must be tuples of (lower q, upper q) with `lower q > upper q`. " + f"Received `q_interval={q_interval}`" + ), + logger=logger, + ) + kwargs["q_interval"] = q_interval + kwargs["q"] = np.sort(np.unique(q_interval)) + return func(*args, **kwargs) + + return wrapper_interval_support
+ +
[docs]def multi_ts_support(func) -> Callable[..., METRIC_OUTPUT_TYPE]: """ This decorator further adapts the metrics that took as input two (or three for scaled metrics with `insample`) @@ -235,12 +288,7 @@

Source code for darts.metrics.metrics

 
         params = signature(func).parameters
         n_jobs = kwargs.pop("n_jobs", params["n_jobs"].default)
-        if not isinstance(n_jobs, int):
-            raise_log(ValueError("n_jobs must be an integer"), logger=logger)
-
         verbose = kwargs.pop("verbose", params["verbose"].default)
-        if not isinstance(verbose, bool):
-            raise_log(ValueError("verbose must be a bool"), logger=logger)
 
         # sanity check reduction functions
         _ = _get_reduction(
@@ -306,6 +354,38 @@ 

Source code for darts.metrics.metrics

             num_series_in_args += int("insample" not in kwargs)
             kwargs.pop("insample", 0)
 
+        # handle `q` (quantile) parameter for probabilistic (or quantile) forecasts
+        if "q" in params:
+            # convert `q` to tuple of (quantile values, optional quantile component names)
+            q = kwargs.get("q", params["q"].default)
+            q_comp_names = None
+            if q is None:
+                kwargs["q"] = None
+            else:
+                if isinstance(q, tuple):
+                    q, q_comp_names = q
+                if isinstance(q, float):
+                    q = np.array([q])
+                else:
+                    q = np.array(q)
+
+                if not np.all(q[1:] - q[:-1] > 0.0):
+                    raise_log(
+                        ValueError(
+                            "`q` must be of type `float`, or a sequence of increasing order with unique values only. "
+                            f"Received `q={q}`."
+                        ),
+                        logger=logger,
+                    )
+                if not np.all(q >= 0.0) & np.all(q <= 1.0):
+                    raise_log(
+                        ValueError(
+                            f"All `q` values must be in the range `(>=0,<=1)`. Received `q={q}`."
+                        ),
+                        logger=logger,
+                    )
+                kwargs["q"] = (q, q_comp_names)
+
         iterator = _build_tqdm_iterator(
             iterable=zip(*input_series),
             verbose=verbose,
@@ -362,20 +442,61 @@ 

Source code for darts.metrics.metrics

         pred_series = args[1]
         num_series_in_args = 2
 
-        if actual_series.width != pred_series.width:
-            raise_log(
-                ValueError(
-                    f"Mismatch between number of components in `actual_series` "
-                    f"(n={actual_series.width}) and `pred_series` (n={pred_series.width}."
-                ),
-                logger=logger,
-            )
+        q, q_comp_names = kwargs.get("q"), None
+        if q is None:
+            # without quantiles, the number of components must match
+            if actual_series.n_components != pred_series.n_components:
+                raise_log(
+                    ValueError(
+                        f"Mismatch between number of components in `actual_series` "
+                        f"(n={actual_series.width}) and `pred_series` (n={pred_series.width})."
+                    ),
+                    logger=logger,
+                )
+            # compute median for stochastic predictions
+            if pred_series.is_stochastic:
+                q = np.array([0.5])
+        else:
+            # `q` is required to be a tuple (handled by `multi_ts_support` wrapper)
+            if not isinstance(q, tuple) or not len(q) == 2:
+                raise_log(
+                    ValueError(
+                        "`q` must be of tuple of `(np.ndarray, Optional[pd.Index])` "
+                        "where the (quantile values, optioanl quantile component names). "
+                        f"Received `q={q}`."
+                    ),
+                    logger=logger,
+                )
+            q, q_comp_names = q
+            if not pred_series.is_stochastic:
+                # quantile component names are required if the predictions are not stochastic (as for stocahstic
+                # predictions, the quantiles can be retrieved from the sample dimension for each component)
+                if q_comp_names is None:
+                    q_comp_names = pd.Index(
+                        likelihood_component_names(
+                            components=actual_series.components,
+                            parameter_names=quantile_names(q=q),
+                        )
+                    )
+                if not q_comp_names.isin(pred_series.components).all():
+                    raise_log(
+                        ValueError(
+                            f"Computing a metric with quantile(s) `q={q}` is only supported for probabilistic "
+                            f"`pred_series` (num samples > 1) or `pred_series` containing the predicted "
+                            f"quantiles as columns / components. Either pass a probabilistic `pred_series` or "
+                            f"a series containing the expected quantile components: {q_comp_names.tolist()} "
+                        ),
+                        logger=logger,
+                    )
+
+        if "q" in params:
+            kwargs["q"] = (q, q_comp_names)
 
         # handle `insample` parameters for scaled metrics
         input_series = (actual_series, pred_series)
         if "insample" in params:
             insample = args[2]
-            if actual_series.width != insample.width:
+            if actual_series.n_components != insample.n_components:
                 raise_log(
                     ValueError(
                         f"Mismatch between number of components in `actual_series` "
@@ -387,15 +508,18 @@ 

Source code for darts.metrics.metrics

             num_series_in_args += 1
 
         vals = func(*input_series, *args[num_series_in_args:], **kwargs)
-        if not 1 <= len(vals.shape) <= 2:
+        # bring vals to shape (n_time, n_comp, n_quantile)
+        if not 2 <= len(vals.shape) <= 3:
             raise_log(
                 ValueError(
-                    "Metric output must have 1 dimension for aggregated metrics (e.g. `mae()`, ...), "
-                    "or 2 dimension for time dependent metrics (e.g. `ae()`, ...)"
+                    "Metric output must have 2 dimensions (n components, n quantiles) "
+                    "for aggregated metrics (e.g. `mae()`, ...), "
+                    "or 3 dimension (n times, n components, n quantiles)  "
+                    "for time dependent metrics (e.g. `ae()`, ...)"
                 ),
                 logger=logger,
             )
-        elif len(vals.shape) == 1:
+        if len(vals.shape) == 2:
             vals = np.expand_dims(vals, TIME_AX)
 
         time_reduction = _get_reduction(
@@ -406,6 +530,7 @@ 

Source code for darts.metrics.metrics

             sanity_check=False,
         )
         if time_reduction is not None:
+            # -> (1, n_comp, n_quantile)
             vals = np.expand_dims(time_reduction(vals, axis=TIME_AX), axis=TIME_AX)
 
         component_reduction = _get_reduction(
@@ -416,40 +541,71 @@ 

Source code for darts.metrics.metrics

             sanity_check=False,
         )
         if component_reduction is not None:
-            vals = np.expand_dims(component_reduction(vals, axis=COMP_AX), axis=COMP_AX)
+            # -> (*, n_quantile)
+            vals = component_reduction(vals, axis=COMP_AX)
+        else:
+            # -> (*, n_comp * n_quantile), with order [c0_q0, c0_q1, ... c1_q0, c1_q1, ...]
+            vals = vals.reshape(vals.shape[0], -1)
         return vals
 
     return wrapper_multivariate_support
def _get_values( - vals: np.ndarray, stochastic_quantile: Optional[float] = 0.5 + vals: np.ndarray, + vals_components: pd.Index, + actual_components: pd.Index, + q: Optional[Tuple[Sequence[float], Union[Optional[pd.Index]]]] = None, ) -> np.ndarray: """ - Returns a deterministic or probabilistic numpy array from the values of a time series. - For stochastic input values, return either all sample values with (stochastic_quantile=None) or the quantile sample - value with (stochastic_quantile {>=0,<=1}) + Returns a deterministic or probabilistic numpy array from the values of a time series of shape + (times, components, samples / quantiles). + To extract quantile (sample) values from quantile or stachastic `vals`, use `q`. + + Parameters + ---------- + vals + A numpy array with the values of a TimeSeries (actual values or predictions). + vals_components + The components of the `vals` TimeSeries. + actual_components + The components of the actual TimeSeries. + q + Optionally, for stochastic or quantile series/values, return deterministic quantile values. + If not `None`, must a tuple with (quantile values, + `None` if `pred_series` is stochastic else the quantile component names). """ - if vals.shape[2] == 1: # deterministic - out = vals[:, :, 0] - else: # stochastic - if stochastic_quantile is None: - out = vals - else: - out = np.quantile(vals, stochastic_quantile, axis=2) - return out + # return values as is (times, components, samples) + if q is None: + return vals + + q, q_names = q + if vals.shape[SMPL_AX] == 1: # deterministic (or quantile components) input + if q_names is not None: + # `q_names` are the component names of the predicted quantile parameters + # we extract the relevant quantile components with shape (times, components * quantiles) + vals = vals[:, vals_components.get_indexer(q_names)] + # rearrange into (times, components, quantiles) + vals = vals.reshape((len(vals), len(actual_components), -1)) + return vals + + # probabilistic input + # compute multiple quantiles for all times and components; with shape: (quantiles, times, components) + out = np.quantile(vals, q, axis=SMPL_AX) + # rearrange into (times, components, quantiles) + return out.transpose((1, 2, 0)) def _get_values_or_raise( series_a: TimeSeries, series_b: TimeSeries, intersect: bool, - stochastic_quantile: Optional[float] = 0.5, + q: Optional[Tuple[Sequence[float], Union[Optional[pd.Index]]]] = None, remove_nan_union: bool = False, is_insample: bool = False, ) -> Tuple[np.ndarray, np.ndarray]: """Returns the processed numpy values of two time series. Processing can be customized with arguments - `intersect, stochastic_quantile, remove_nan_union`. + `intersect, q, remove_nan_union`. Parameters ---------- @@ -460,9 +616,10 @@

Source code for darts.metrics.metrics

         A deterministic or stochastic ``TimeSeries`` instance (the predictions `pred_series`).
     intersect
         A boolean for whether to only consider the time intersection between `series_a` and `series_b`
-    stochastic_quantile
-        Optionally, for stochastic predicted series, return either all sample values with (`stochastic_quantile=None`)
-        or any deterministic quantile sample values by setting `stochastic_quantile=quantile` {>=0,<=1}.
+    q
+        Optionally, for predicted stochastic or quantile series, return deterministic quantile values.
+        If not `None`, must a tuple with (quantile values,
+        `None` if `pred_series` is stochastic else the quantile component names).
     remove_nan_union
         By setting `remove_non_union` to True, sets all values from `series_a` and `series_b` to `np.nan` at indices
         where any of the two series contain a NaN value. Only effective when `is_insample=False`.
@@ -474,16 +631,6 @@ 

Source code for darts.metrics.metrics

     ValueError
         If `is_insample=False` and the two time series do not have at least a partially overlapping time index.
     """
-
-    if not series_a.width == series_b.width:
-        raise_log(
-            ValueError("The two time series must have the same number of components"),
-            logger=logger,
-        )
-
-    if not isinstance(intersect, bool):
-        raise_log(ValueError("The intersect parameter must be a bool"), logger=logger)
-
     make_copy = False
     if not is_insample:
         # get the time intersection and values of the two series (corresponds to `actual_series` and `pred_series`
@@ -494,15 +641,12 @@ 

Source code for darts.metrics.metrics

             vals_a_common = series_a.slice_intersect_values(series_b, copy=make_copy)
             vals_b_common = series_b.slice_intersect_values(series_a, copy=make_copy)
 
-        if not len(vals_a_common) == len(vals_b_common):
-            raise_log(
-                ValueError(
-                    "The two time series must have at least a partially overlapping time index."
-                ),
-                logger=logger,
-            )
-
-        vals_b_det = _get_values(vals_b_common, stochastic_quantile=stochastic_quantile)
+        vals_b = _get_values(
+            vals=vals_b_common,
+            vals_components=series_b.components,
+            actual_components=series_a.components,
+            q=q,
+        )
     else:
         # for `insample` series we extract only values up until before start of `pred_series`
         # find how many steps `insample` overlaps into `series_b`
@@ -522,36 +666,67 @@ 

Source code for darts.metrics.metrics

             )
         end = end or None
         vals_a_common = series_a.all_values(copy=make_copy)[:end]
-        vals_b_det = None
-    vals_a_det = _get_values(vals_a_common, stochastic_quantile=stochastic_quantile)
+        vals_b = None
+    vals_a = _get_values(
+        vals=vals_a_common,
+        vals_components=series_a.components,
+        actual_components=series_a.components,
+        q=([0.5], None),
+    )
 
     if not remove_nan_union or is_insample:
-        return vals_a_det, vals_b_det
+        return vals_a, vals_b
 
-    b_is_deterministic = bool(len(vals_b_det.shape) == 2)
-    if b_is_deterministic:
-        isnan_mask = np.logical_or(np.isnan(vals_a_det), np.isnan(vals_b_det))
-        isnan_mask_pred = isnan_mask
-    else:
-        isnan_mask = np.logical_or(
-            np.isnan(vals_a_det), np.isnan(vals_b_det).any(axis=2)
-        )
-        isnan_mask_pred = np.repeat(
-            np.expand_dims(isnan_mask, axis=-1), vals_b_det.shape[2], axis=2
-        )
-    return np.where(isnan_mask, np.nan, vals_a_det), np.where(
-        isnan_mask_pred, np.nan, vals_b_det
+    isnan_mask = np.expand_dims(
+        np.logical_or(np.isnan(vals_a), np.isnan(vals_b)).any(axis=SMPL_AX), axis=-1
+    )
+    isnan_mask_pred = np.repeat(isnan_mask, vals_b.shape[SMPL_AX], axis=SMPL_AX)
+    return np.where(isnan_mask, np.nan, vals_a), np.where(
+        isnan_mask_pred, np.nan, vals_b
     )
 
 
+def _get_quantile_intervals(
+    vals: np.ndarray,
+    q: Tuple[Sequence[float], Any],
+    q_interval: np.ndarray = None,
+) -> Tuple[np.ndarray, np.ndarray]:
+    """Returns the lower and upper bound values from `vals` for all quantile intervals in `q_interval`.
+
+    Parameters
+    ----------
+    vals
+        A numpy array with predicted quantile values of shape (n times, n components, n quantiles).
+    q
+        A tuple with (quantile values, any).
+    q_interval
+        A numpy array with the lower and upper quantile interval bound of shape (n intervals, 2).
+    """
+    q, _ = q
+    # find index of every `q_interval` value in `q`; we have guarantees from support wrappers:
+    # - `q` has increasing order
+    # - `vals` has same order as `q` in dim 3 (quantile dim)
+    # - `q_interval` holds (lower q, upper q) in that order
+    q_idx = np.searchsorted(q, q_interval.flatten()).reshape(q_interval.shape)
+    return vals[:, :, q_idx[:, 0]], vals[:, :, q_idx[:, 1]]
+
+
 def _get_wrapped_metric(
-    func: Callable[..., METRIC_OUTPUT_TYPE],
+    func: Callable[..., METRIC_OUTPUT_TYPE], n_wrappers: int = 2
 ) -> Callable[..., METRIC_OUTPUT_TYPE]:
     """Returns the inner metric function `func` which bypasses the decorators `multi_ts_support` and
     `multivariate_support`. It significantly decreases process time compared to calling `func` directly.
     Only use this to compute a pre-defined metric within the scope of another metric.
     """
-    return func.__wrapped__.__wrapped__
+    if not 2 <= n_wrappers <= 3:
+        raise_log(
+            NotImplementedError("Only 2-3 wrappers are currently supported"),
+            logger=logger,
+        )
+    if n_wrappers == 2:
+        return func.__wrapped__.__wrapped__
+    else:
+        return func.__wrapped__.__wrapped__.__wrapped__
 
 
 def _get_reduction(
@@ -646,6 +821,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -659,8 +835,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: y_t - \\hat{y}_t
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -671,6 +848,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -682,10 +861,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -717,7 +897,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=False
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=False,
+        q=q,
     )
     return y_true - y_pred
@@ -729,6 +913,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -741,8 +926,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: \\frac{1}{T}\\sum_{t=1}^T{(y_t - \\hat{y}_t)}
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -753,16 +939,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -793,6 +982,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -805,6 +995,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -818,8 +1009,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: |y_t - \\hat{y}_t|
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -830,6 +1022,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -841,15 +1035,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
-    series_reduction
-        Optionally, a function taking as input a ``np.ndarray`` and returning either a scalar value or a ``np.ndarray``.
-        This function is used to aggregate the metrics in case the metric is evaluated on multiple series
-        (e.g., on a ``Sequence[TimeSeries]``). By default, returns the metric for each series.
-        Example: ``series_reduction=np.nanmean``, will return the average over all series metrics.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -881,7 +1071,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=False
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=False,
+        q=q,
     )
     return np.abs(y_true - y_pred)
@@ -893,6 +1087,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -905,8 +1100,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: \\frac{1}{T}\\sum_{t=1}^T{|y_t - \\hat{y}_t|}
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -917,21 +1113,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
-    series_reduction
-        Optionally, a function taking as input a ``np.ndarray`` and returning either a scalar value or a ``np.ndarray``.
-        This function is used to aggregate the metrics in case the metric is evaluated on multiple series
-        (e.g., on a ``Sequence[TimeSeries]``). By default, returns the metric for each series.
-        Example: ``series_reduction=np.nanmean``, will return the average over all series metrics.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -962,6 +1156,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -976,6 +1171,7 @@

Source code for darts.metrics.metrics

     m: int = 1,
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -997,8 +1193,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: E_m = MAE(y_{m:t_p}, y_{0:t_p - m}).
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1016,6 +1213,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -1027,10 +1226,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1075,6 +1275,7 @@ 

Source code for darts.metrics.metrics

         actual_series,
         pred_series,
         intersect,
+        q=q,
     )
     return errors / error_scale
@@ -1088,6 +1289,7 @@

Source code for darts.metrics.metrics

     m: int = 1,
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -1108,8 +1310,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: E_m = MAE(y_{m:t_p}, y_{0:t_p - m}).
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1127,16 +1330,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1179,6 +1385,7 @@ 

Source code for darts.metrics.metrics

             insample,
             m=m,
             intersect=intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -1191,6 +1398,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -1204,8 +1412,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: (y_t - \\hat{y}_t)^2.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1216,6 +1425,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -1227,10 +1438,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1262,7 +1474,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=False
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=False,
+        q=q,
     )
     return (y_true - y_pred) ** 2
@@ -1274,6 +1490,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -1286,8 +1503,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: \\frac{1}{T}\\sum_{t=1}^T{(y_t - \\hat{y}_t)^2}.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1298,16 +1516,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1338,6 +1559,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -1352,6 +1574,7 @@

Source code for darts.metrics.metrics

     m: int = 1,
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -1373,8 +1596,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: E_m = MSE(y_{m:t_p}, y_{0:t_p - m}).
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1392,6 +1616,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -1403,10 +1629,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1451,6 +1678,7 @@ 

Source code for darts.metrics.metrics

         actual_series,
         pred_series,
         intersect,
+        q=q,
     )
     return errors / error_scale
@@ -1464,6 +1692,7 @@

Source code for darts.metrics.metrics

     m: int = 1,
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -1484,8 +1713,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: E_m = MSE(y_{m:t_p}, y_{0:t_p - m}).
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1503,16 +1733,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1555,6 +1788,7 @@ 

Source code for darts.metrics.metrics

             insample,
             m=m,
             intersect=intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -1567,6 +1801,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -1579,8 +1814,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: \\sqrt{\\frac{1}{T}\\sum_{t=1}^T{(y_t - \\hat{y}_t)^2}}
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1591,16 +1827,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1631,6 +1870,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         )
     )
@@ -1644,6 +1884,7 @@

Source code for darts.metrics.metrics

     m: int = 1,
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -1664,8 +1905,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: E_m = RMSE(y_{m:t_p}, y_{0:t_p - m}).
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1683,16 +1925,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1733,6 +1978,7 @@ 

Source code for darts.metrics.metrics

         actual_series,
         pred_series,
         intersect,
+        q=q,
     )
     return errors / error_scale
@@ -1744,6 +1990,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -1759,8 +2006,9 @@ 

Source code for darts.metrics.metrics

 
     using the natural logarithm.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1771,6 +2019,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -1782,10 +2032,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1817,7 +2068,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=False
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=False,
+        q=q,
     )
     y_true, y_pred = np.log(y_true + 1), np.log(y_pred + 1)
     return (y_true - y_pred) ** 2
@@ -1830,6 +2085,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -1844,8 +2100,9 @@ 

Source code for darts.metrics.metrics

 
     using the natural logarithm.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1856,16 +2113,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1897,6 +2157,7 @@ 

Source code for darts.metrics.metrics

                 actual_series,
                 pred_series,
                 intersect,
+                q=q,
             ),
             axis=TIME_AX,
         )
@@ -1910,6 +2171,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -1926,8 +2188,9 @@ 

Source code for darts.metrics.metrics

     Note that it will raise a `ValueError` if :math:`y_t = 0` for some :math:`t`. Consider using
     the Absolute Scaled Error (:func:`~darts.metrics.metrics.ase`) in these cases.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -1938,6 +2201,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -1949,10 +2214,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -1989,7 +2255,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=False
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=False,
+        q=q,
     )
     if not (y_true != 0).all():
         raise_log(
@@ -2008,6 +2278,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2023,8 +2294,9 @@ 

Source code for darts.metrics.metrics

     Note that it will raise a `ValueError` if :math:`y_t = 0` for some :math:`t`. Consider using
     the Mean Absolute Scaled Error (:func:`~darts.metrics.metrics.mase`) in these cases.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2035,16 +2307,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2081,6 +2356,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -2093,6 +2369,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -2110,8 +2387,9 @@ 

Source code for darts.metrics.metrics

     Note that it will raise a `ValueError` if :math:`\\left| y_t \\right| + \\left| \\hat{y}_t \\right| = 0` for some
     :math:`t`. Consider using the Absolute Scaled Error (:func:`~darts.metrics.metrics.ase`)  in these cases.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2122,6 +2400,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -2133,10 +2413,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2173,7 +2454,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=True
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=True,
+        q=q,
     )
     if not np.logical_or(y_true != 0, y_pred != 0).all():
         raise_log(
@@ -2192,6 +2477,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2210,8 +2496,9 @@ 

Source code for darts.metrics.metrics

     for some :math:`t`. Consider using the Mean Absolute Scaled Error (:func:`~darts.metrics.metrics.mase`) in these
     cases.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2222,16 +2509,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2268,6 +2558,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -2280,6 +2571,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2293,8 +2585,9 @@ 

Source code for darts.metrics.metrics

     .. math:: 100 \\cdot \\left| \\frac{\\sum_{t=1}^{T}{y_t}
               - \\sum_{t=1}^{T}{\\hat{y}_t}}{\\sum_{t=1}^{T}{y_t}} \\right|.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2305,16 +2598,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2347,7 +2643,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=True
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=True,
+        q=q,
     )
     y_true_sum, y_pred_sum = (
         np.nansum(y_true, axis=TIME_AX),
@@ -2370,6 +2670,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -2383,8 +2684,9 @@ 

Source code for darts.metrics.metrics

 
     .. math:: 100 \\cdot \\left| \\frac{y_t - \\hat{y}_t} {\\max_t{y_t} - \\min_t{y_t}} \\right|
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2395,6 +2697,8 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     time_reduction
         Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a
@@ -2406,10 +2710,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2446,7 +2751,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=True
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=True,
+        q=q,
     )
     y_max, y_min = np.nanmax(y_true, axis=TIME_AX), np.nanmin(y_true, axis=TIME_AX)
     if not (y_max > y_min).all():
@@ -2468,6 +2777,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2481,8 +2791,9 @@ 

Source code for darts.metrics.metrics

     .. math:: 100 \\cdot \\frac{1}{T} \\sum_{t=1}^{T} {\\left| \\frac{y_t - \\hat{y}_t} {\\max_t{y_t} -
               \\min_t{y_t}} \\right|}
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2493,16 +2804,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2536,6 +2850,7 @@ 

Source code for darts.metrics.metrics

             actual_series,
             pred_series,
             intersect,
+            q=q,
         ),
         axis=TIME_AX,
     )
@@ -2548,6 +2863,7 @@

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2564,8 +2880,9 @@ 

Source code for darts.metrics.metrics

 
     This metric is not symmetric.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2576,16 +2893,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2616,7 +2936,11 @@ 

Source code for darts.metrics.metrics

     .. [1] https://en.wikipedia.org/wiki/Coefficient_of_determination
     """
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=True
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=True,
+        q=q,
     )
     ss_errors = np.nansum((y_true - y_pred) ** 2, axis=TIME_AX)
     y_hat = np.nanmean(y_true, axis=TIME_AX)
@@ -2631,6 +2955,7 @@ 

Source code for darts.metrics.metrics

     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
     intersect: bool = True,
     *,
+    q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2646,8 +2971,9 @@ 

Source code for darts.metrics.metrics

     where :math:`RMSE` is the Root Mean Squared Error (:func:`~darts.metrics.metrics.rmse`), and :math:`\\bar{y}` is
     the average of :math:`y` over all time steps.
 
-    If any of the series is stochastic (containing several samples), :math:`\\hat{y}_t` is the median over all samples
-    for time step :math:`t`.
+    If :math:`\\hat{y}_t` are stochastic (contains several samples) or quantile predictions, use parameter `q` to
+    specify on which quantile(s) to compute the metric on. By default, it uses the median 0.5 quantile
+    (over all samples, or, if given, the quantile prediction itself).
 
     Parameters
     ----------
@@ -2658,16 +2984,19 @@ 

Source code for darts.metrics.metrics

     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        Optionally, the quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2695,7 +3024,11 @@ 

Source code for darts.metrics.metrics

     """
 
     y_true, y_pred = _get_values_or_raise(
-        actual_series, pred_series, intersect, remove_nan_union=True
+        actual_series,
+        pred_series,
+        intersect,
+        remove_nan_union=True,
+        q=q,
     )
     # not calling rmse as y_true and y_pred are np.ndarray
     return (
@@ -2747,10 +3080,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2790,9 +3124,9 @@ 

Source code for darts.metrics.metrics

 def qr(
     actual_series: Union[TimeSeries, Sequence[TimeSeries]],
     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
-    q: float = 0.5,
     intersect: bool = True,
     *,
+    q: Union[float, List[float], Tuple[np.ndarray, pd.Index]] = 0.5,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -2821,21 +3155,22 @@ 

Source code for darts.metrics.metrics

         The (sequence of) actual series.
     pred_series
         The (sequence of) predicted series.
-    q
-        The quantile (float [0, 1]) of interest for the risk evaluation.
     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        The quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2873,18 +3208,19 @@ 

Source code for darts.metrics.metrics

         actual_series,
         pred_series,
         intersect,
-        stochastic_quantile=None,
+        q=None,
         remove_nan_union=True,
     )
     z_true = np.nansum(z_true, axis=TIME_AX)
     z_hat = np.nansum(
         z_hat, axis=TIME_AX
     )  # aggregate all individual sample realizations
+    # quantile loss
+    q, _ = q
     z_hat_rho = np.quantile(
         z_hat, q=q, axis=1
-    )  # get the quantile from aggregated samples
+    ).T  # get the quantile from aggregated samples
 
-    # quantile loss
     errors = z_true - z_hat_rho
     losses = 2 * np.maximum((q - 1) * errors, q * errors)
     return losses / z_true
@@ -2895,9 +3231,9 @@

Source code for darts.metrics.metrics

 def ql(
     actual_series: Union[TimeSeries, Sequence[TimeSeries]],
     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
-    q: float = 0.5,
     intersect: bool = True,
     *,
+    q: Union[float, List[float], Tuple[np.ndarray, pd.Index]] = 0.5,
     time_reduction: Optional[Callable[..., np.ndarray]] = None,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
@@ -2907,7 +3243,8 @@ 

Source code for darts.metrics.metrics

     """Quantile Loss (QL).
 
     Also known as Pinball Loss. QL is a metric that quantifies the accuracy of a specific quantile :math:`q` from the
-    predicted value distribution of a stochastic/probabilistic `pred_series` containing N samples.
+    predicted deterministic quantiles or value distribution of a stochastic/probabilistic `pred_series` containing N
+    samples.
 
     QL computes the quantile of all sample values and the loss per time step.
 
@@ -2916,7 +3253,7 @@ 

Source code for darts.metrics.metrics

 
     .. math:: 2 \\max((q - 1) (y_t - \\hat{y}_{t,q}), q (y_t - \\hat{y}_{t,q})),
 
-    where :math:`\\hat{y}_{t,q}` is the quantile :math:`q` of all predicted sample values at time :math:`t`.
+    where :math:`\\hat{y}_{t,q}` is quantile value :math:`q` (of all predicted quantiles or samples) at time :math:`t`.
     The factor `2` makes the loss more interpretable, as for `q=0.5` the loss is identical to the Absolute Error
     (:func:`~darts.metrics.metrics.ae`).
 
@@ -2926,11 +3263,11 @@ 

Source code for darts.metrics.metrics

         The (sequence of) actual series.
     pred_series
         The (sequence of) predicted series.
-    q
-        The quantile (float [0, 1]) of interest for the loss.
     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        The quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
@@ -2942,10 +3279,11 @@ 

Source code for darts.metrics.metrics

         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
         time axis. If `None`, will return a metric per time step.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -2975,22 +3313,14 @@ 

Source code for darts.metrics.metrics

     List[np.ndarray]
         Same as for type `np.ndarray` but for a sequence of series.
     """
-    if not pred_series.is_stochastic:
-        raise_log(
-            ValueError(
-                "quantile/pinball loss (ql) should only be computed for "
-                "stochastic predicted TimeSeries."
-            ),
-            logger=logger,
-        )
-
     y_true, y_pred = _get_values_or_raise(
         actual_series,
         pred_series,
         intersect,
-        stochastic_quantile=q,
+        q=q,
         remove_nan_union=True,
     )
+    q, _ = q
     errors = y_true - y_pred
     losses = 2.0 * np.maximum((q - 1) * errors, q * errors)
     return losses
@@ -3001,9 +3331,9 @@

Source code for darts.metrics.metrics

 def mql(
     actual_series: Union[TimeSeries, Sequence[TimeSeries]],
     pred_series: Union[TimeSeries, Sequence[TimeSeries]],
-    q: float = 0.5,
     intersect: bool = True,
     *,
+    q: Union[float, List[float], Tuple[np.ndarray, pd.Index]] = 0.5,
     component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean,
     series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None,
     n_jobs: int = 1,
@@ -3012,7 +3342,8 @@ 

Source code for darts.metrics.metrics

     """Mean Quantile Loss (MQL).
 
     Also known as Pinball Loss. QL is a metric that quantifies the accuracy of a specific quantile :math:`q` from the
-    predicted value distribution of a stochastic/probabilistic `pred_series` containing N samples.
+    predicted deterministic quantiles or value distribution of a stochastic/probabilistic `pred_series` containing N
+    samples.
 
     MQL first computes the quantile of all sample values and the loss per time step, and then takes the mean over the
     time axis.
@@ -3022,7 +3353,7 @@ 

Source code for darts.metrics.metrics

 
     .. math:: 2 \\frac{1}{T}\\sum_{t=1}^T{\\max((q - 1) (y_t - \\hat{y}_{t,q}), q (y_t - \\hat{y}_{t,q}))},
 
-    where :math:`\\hat{y}_{t,q}` is the quantile :math:`q` of all predicted sample values at time :math:`t`.
+    where :math:`\\hat{y}_{t,q}` is quantile value :math:`q` (of all predicted quantiles or samples) at time :math:`t`.
     The factor `2` makes the loss more interpretable, as for `q=0.5` the loss is identical to the Mean Absolute Error
     (:func:`~darts.metrics.metrics.mae`).
 
@@ -3032,21 +3363,22 @@ 

Source code for darts.metrics.metrics

         The (sequence of) actual series.
     pred_series
         The (sequence of) predicted series.
-    q
-        The quantile (float [0, 1]) of interest for the loss.
     intersect
         For time series that are overlapping in time without having the same time index, setting `True`
         will consider the values only over their common time interval (intersection in time).
+    q
+        The quantile (float [0, 1]) or list of quantiles of interest to compute the metric on.
     component_reduction
         Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray`
         of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the
         component axis. If `None`, will return a metric per component.
     series_reduction
-        Optionally, a function to aggregate the metrics over the series axis. It must reduce a `np.ndarray`
+        Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray`
         of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a
         parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the
-        series axis. If `None`, will return a metric per series.
+        series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will
+        return a metric per component.
     n_jobs
         The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
         passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
@@ -3081,6 +3413,195 @@ 

Source code for darts.metrics.metrics

         ),
         axis=TIME_AX,
     )
+ + +
[docs]@interval_support +@multi_ts_support +@multivariate_support +def iw( + actual_series: Union[TimeSeries, Sequence[TimeSeries]], + pred_series: Union[TimeSeries, Sequence[TimeSeries]], + intersect: bool = True, + *, + q_interval: Union[Tuple[float, float], Sequence[Tuple[float, float]]] = None, + q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None, + time_reduction: Optional[Callable[..., np.ndarray]] = None, + component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean, + series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None, + n_jobs: int = 1, + verbose: bool = False, +) -> METRIC_OUTPUT_TYPE: + """Interval Width (IL). + + IL gives the width of predicted quantile intervals. + + For the true series :math:`y` and predicted stochastic or quantile series :math:`\\hat{y}` of length :math:`T`, + it is computed per component/column, quantile interval, and time step + :math:`t` as: + + .. math:: \\hat{y}_{t,qh} - \\hat{y}_{t,ql} + + where :math:`\\hat{y}_{t,qh}` are the upper bound quantile values (of all predicted quantiles or samples) at time + :math:`t`, and :math:`\\hat{y}_{t,ql}` are the lower bound quantile values. + + Parameters + ---------- + actual_series + The (sequence of) actual series. + pred_series + The (sequence of) predicted series. + intersect + For time series that are overlapping in time without having the same time index, setting `True` + will consider the values only over their common time interval (intersection in time). + q_interval + The quantile interval(s) to compute the metric on. Must be a tuple (single interval) or sequence tuples + (multiple intervals) with elements (low quantile, high quantile). + q + Quantiles `q` not supported by this metric; use `q_interval` instead. + component_reduction + Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray` + of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a + parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the + component axis. If `None`, will return a metric per component. + time_reduction + Optionally, a function to aggregate the metrics over the time axis. It must reduce a `np.ndarray` + of shape `(t, c)` to a `np.ndarray` of shape `(c,)`. The function takes as input a ``np.ndarray`` and a + parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the + time axis. If `None`, will return a metric per time step. + series_reduction + Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray` + of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a + parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the + series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will + return a metric per component. + n_jobs + The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is + passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1` + (sequential). Setting the parameter to `-1` means using all the available processors. + verbose + Optionally, whether to print operations progress + + Returns + ------- + float + A single metric score for: + + - single univariate series. + - single multivariate series with `component_reduction`. + - a sequence (list) of uni/multivariate series with `series_reduction`, `component_reduction` and + `time_reduction`. + np.ndarray + A numpy array of metric scores. The array has shape (n time steps, n components) without time + and component reductions. For: + + - single multivariate series and at least `component_reduction=None`. + - single uni/multivariate series and at least `time_reduction=None`. + - a sequence of uni/multivariate series including `series_reduction` and at least one of + `component_reduction=None` or `time_reduction=None`. + List[float] + Same as for type `float` but for a sequence of series. + List[np.ndarray] + Same as for type `np.ndarray` but for a sequence of series. + """ + y_true, y_pred = _get_values_or_raise( + actual_series, + pred_series, + intersect, + remove_nan_union=True, + q=q, + ) + y_pred_lo, y_pred_hi = _get_quantile_intervals(y_pred, q=q, q_interval=q_interval) + return y_pred_hi - y_pred_lo
+ + +
[docs]@interval_support +@multi_ts_support +@multivariate_support +def miw( + actual_series: Union[TimeSeries, Sequence[TimeSeries]], + pred_series: Union[TimeSeries, Sequence[TimeSeries]], + intersect: bool = True, + *, + q_interval: Union[Tuple[float, float], Sequence[Tuple[float, float]]] = None, + q: Optional[Union[float, List[float], Tuple[np.ndarray, pd.Index]]] = None, + component_reduction: Optional[Callable[[np.ndarray], float]] = np.nanmean, + series_reduction: Optional[Callable[[np.ndarray], Union[float, np.ndarray]]] = None, + n_jobs: int = 1, + verbose: bool = False, +) -> METRIC_OUTPUT_TYPE: + """Mean Interval Width (IL). + + IL gives the width of predicted quantile intervals aggregated over time. + + For the true series :math:`y` and predicted stochastic or quantile series :math:`\\hat{y}` of length :math:`T`, + it is computed per component/column, quantile interval, and time step + :math:`t` as: + + .. math:: \\frac{1}{T}\\sum_{t=1}^T{\\hat{y}_{t,qh} - \\hat{y}_{t,ql}} + + where :math:`\\hat{y}_{t,qh}` are the upper bound quantile values (of all predicted quantiles or samples) at time + :math:`t`, and :math:`\\hat{y}_{t,ql}` are the lower bound quantile values. + + Parameters + ---------- + actual_series + The (sequence of) actual series. + pred_series + The (sequence of) predicted series. + intersect + For time series that are overlapping in time without having the same time index, setting `True` + will consider the values only over their common time interval (intersection in time). + q_interval + The quantile interval(s) to compute the metric on. Must be a tuple (single interval) or sequence tuples + (multiple intervals) with elements (low quantile, high quantile). + q + Quantiles `q` not supported by this metric; use `q_interval` instead. + component_reduction + Optionally, a function to aggregate the metrics over the component/column axis. It must reduce a `np.ndarray` + of shape `(t, c)` to a `np.ndarray` of shape `(t,)`. The function takes as input a ``np.ndarray`` and a + parameter named `axis`, and returns the reduced array. The `axis` receives value `1` corresponding to the + component axis. If `None`, will return a metric per component. + series_reduction + Optionally, a function to aggregate the metrics over multiple series. It must reduce a `np.ndarray` + of shape `(s, t, c)` to a `np.ndarray` of shape `(t, c)` The function takes as input a ``np.ndarray`` and a + parameter named `axis`, and returns the reduced array. The `axis` receives value `0` corresponding to the + series axis. For example with `np.nanmean`, will return the average over all series metrics. If `None`, will + return a metric per component. + n_jobs + The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is + passed as input, parallelising operations regarding different ``TimeSeries``. Defaults to `1` + (sequential). Setting the parameter to `-1` means using all the available processors. + verbose + Optionally, whether to print operations progress + + Returns + ------- + float + A single metric score for: + + - single univariate series. + - single multivariate series with `component_reduction`. + - sequence (list) of uni/multivariate series with `series_reduction` and `component_reduction`. + np.ndarray + A numpy array of metric scores. The array has shape (n components,) without component reduction. For: + + - single multivariate series and at least `component_reduction=None`. + - sequence of uni/multivariate series including `series_reduction` and `component_reduction=None`. + List[float] + Same as for type `float` but for a sequence of series. + List[np.ndarray] + Same as for type `np.ndarray` but for a sequence of series. + """ + return np.nanmean( + _get_wrapped_metric(iw, n_wrappers=3)( + actual_series, + pred_series, + intersect, + q=q, + q_interval=q_interval, + ), + axis=TIME_AX, + )
diff --git a/_modules/darts/models/components/feed_forward.html b/_modules/darts/models/components/feed_forward.html index a99382ae4b..f1319b8946 100644 --- a/_modules/darts/models/components/feed_forward.html +++ b/_modules/darts/models/components/feed_forward.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/components/glu_variants.html b/_modules/darts/models/components/glu_variants.html index 7c8121935f..2324efdcda 100644 --- a/_modules/darts/models/components/glu_variants.html +++ b/_modules/darts/models/components/glu_variants.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/components/layer_norm_variants.html b/_modules/darts/models/components/layer_norm_variants.html index f3f5e5a969..91f8cad7d7 100644 --- a/_modules/darts/models/components/layer_norm_variants.html +++ b/_modules/darts/models/components/layer_norm_variants.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/components/statsforecast_utils.html b/_modules/darts/models/components/statsforecast_utils.html index e0d3f5bb76..d4fb40c119 100644 --- a/_modules/darts/models/components/statsforecast_utils.html +++ b/_modules/darts/models/components/statsforecast_utils.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/components/transformer.html b/_modules/darts/models/components/transformer.html index 06666e6ca1..865f0f9ee0 100644 --- a/_modules/darts/models/components/transformer.html +++ b/_modules/darts/models/components/transformer.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/filtering/filtering_model.html b/_modules/darts/models/filtering/filtering_model.html index 09132b21a6..5ea2709053 100644 --- a/_modules/darts/models/filtering/filtering_model.html +++ b/_modules/darts/models/filtering/filtering_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/filtering/gaussian_process_filter.html b/_modules/darts/models/filtering/gaussian_process_filter.html index 9f79fb733c..ca09f016c2 100644 --- a/_modules/darts/models/filtering/gaussian_process_filter.html +++ b/_modules/darts/models/filtering/gaussian_process_filter.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/filtering/kalman_filter.html b/_modules/darts/models/filtering/kalman_filter.html index aa289b971f..d622223d0a 100644 --- a/_modules/darts/models/filtering/kalman_filter.html +++ b/_modules/darts/models/filtering/kalman_filter.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/filtering/moving_average_filter.html b/_modules/darts/models/filtering/moving_average_filter.html index 7d75d635d1..2bf7b00c15 100644 --- a/_modules/darts/models/filtering/moving_average_filter.html +++ b/_modules/darts/models/filtering/moving_average_filter.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/arima.html b/_modules/darts/models/forecasting/arima.html index c48fe8fba3..d9d77d27cd 100644 --- a/_modules/darts/models/forecasting/arima.html +++ b/_modules/darts/models/forecasting/arima.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/auto_arima.html b/_modules/darts/models/forecasting/auto_arima.html index ec0c1a15cf..aadd20f8d3 100644 --- a/_modules/darts/models/forecasting/auto_arima.html +++ b/_modules/darts/models/forecasting/auto_arima.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/baselines.html b/_modules/darts/models/forecasting/baselines.html index b7c81c7d45..996bf2a4ea 100644 --- a/_modules/darts/models/forecasting/baselines.html +++ b/_modules/darts/models/forecasting/baselines.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/block_rnn_model.html b/_modules/darts/models/forecasting/block_rnn_model.html index 182c1cc054..8586943ada 100644 --- a/_modules/darts/models/forecasting/block_rnn_model.html +++ b/_modules/darts/models/forecasting/block_rnn_model.html @@ -34,7 +34,7 @@ - + @@ -205,6 +205,7 @@

Source code for darts.models.forecasting.block_rnn_model

nr_params: int, num_layers_out_fc: Optional[List] = None, dropout: float = 0.0, + activation: str = "ReLU", **kwargs, ): """This class allows to create custom block RNN modules that can later be used with Darts' @@ -238,6 +239,8 @@

Source code for darts.models.forecasting.block_rnn_model

This network connects the last hidden layer of the PyTorch RNN module to the output. dropout The fraction of neurons that are dropped in all-but-last RNN layers. + activation + The name of the activation function to be applied between the layers of the fully connected network. **kwargs all parameters required for :class:`darts.models.forecasting.pl_forecasting_module.PLForecastingModule` base class. @@ -252,6 +255,7 @@

Source code for darts.models.forecasting.block_rnn_model

self.nr_params = nr_params self.num_layers_out_fc = [] if num_layers_out_fc is None else num_layers_out_fc self.dropout = dropout + self.activation = activation self.out_len = self.output_chunk_length
[docs] @io_processor @@ -280,6 +284,7 @@

Source code for darts.models.forecasting.block_rnn_model

def __init__( self, name: str, + activation: Optional[str] = None, **kwargs, ): """PyTorch module implementing a block RNN to be used in `BlockRNNModel`. @@ -291,6 +296,7 @@

Source code for darts.models.forecasting.block_rnn_model

This module uses an RNN to encode the input sequence, and subsequently uses a fully connected network as the decoder which takes as input the last hidden state of the encoder RNN. + Optionally, a non-linear activation function can be applied between the layers of the fully connected network. The final output of the decoder is a sequence of length `output_chunk_length`. In this sense, the `_BlockRNNModule` produces 'blocks' of forecasts at a time (which is different from `_RNNModule` used by the `RNNModel`). @@ -299,6 +305,9 @@

Source code for darts.models.forecasting.block_rnn_model

---------- name The name of the specific PyTorch RNN module ("RNN", "GRU" or "LSTM"). + activation + The name of the activation function to be applied between the layers of the fully connected network. + Options include "ReLU", "Sigmoid", "Tanh", or None for no activation. Default: None. **kwargs all parameters required for the :class:`darts.models.forecasting.CustomBlockRNNModule` base class. @@ -330,10 +339,15 @@

Source code for darts.models.forecasting.block_rnn_model

# to the output of desired length last = self.hidden_dim feats = [] - for feature in self.num_layers_out_fc + [ - self.out_len * self.target_size * self.nr_params - ]: + for index, feature in enumerate( + self.num_layers_out_fc + [self.out_len * self.target_size * self.nr_params] + ): feats.append(nn.Linear(last, feature)) + + # Add activation only between layers, but not on the final layer + if activation and index < len(self.num_layers_out_fc): + activation_function = getattr(nn, activation)() + feats.append(activation_function) last = feature self.fc = nn.Sequential(*feats) @@ -370,6 +384,7 @@

Source code for darts.models.forecasting.block_rnn_model

n_rnn_layers: int = 1, hidden_fc_sizes: Optional[List] = None, dropout: float = 0.0, + activation: str = "ReLU", **kwargs, ): """Block Recurrent Neural Network Model (RNNs). @@ -418,6 +433,9 @@

Source code for darts.models.forecasting.block_rnn_model

Sizes of hidden layers connecting the last hidden layer of the RNN module to the output, if any. dropout Fraction of neurons afected by Dropout. + activation + The name of a torch.nn activation function to be applied between the layers of the fully connected network. + Default: "ReLU". **kwargs Optional arguments to initialize the pytorch_lightning.Module, pytorch_lightning.Trainer, and Darts' :class:`TorchForecastingModel`. @@ -610,6 +628,7 @@

Source code for darts.models.forecasting.block_rnn_model

self.hidden_dim = hidden_dim self.n_rnn_layers = n_rnn_layers self.dropout = dropout + self.activation = activation @property def supports_multivariate(self) -> bool: @@ -639,9 +658,18 @@

Source code for darts.models.forecasting.block_rnn_model

num_layers=self.n_rnn_layers, num_layers_out_fc=hidden_fc_sizes, dropout=self.dropout, + activation=self.activation, **self.pl_module_params, **kwargs, - )
+ ) + + def _check_ckpt_parameters(self, tfm_save): + # new parameters were added that will break loading weights + new_params = ["activation"] + for param in new_params: + if param not in tfm_save.model_params: + tfm_save.model_params[param] = "ReLU" + super()._check_ckpt_parameters(tfm_save)
diff --git a/_modules/darts/models/forecasting/catboost_model.html b/_modules/darts/models/forecasting/catboost_model.html index 533eb10c90..a389a3293a 100644 --- a/_modules/darts/models/forecasting/catboost_model.html +++ b/_modules/darts/models/forecasting/catboost_model.html @@ -34,7 +34,7 @@ - + @@ -297,8 +297,9 @@

Source code for darts.models.forecasting.catboost_model

Control the randomness in the fitting procedure and for sampling. Default: ``None``. multi_models - If True, a separate model will be trained for each future lag to predict. If False, a single model is - trained to predict at step 'output_chunk_length' in the future. Default: True. + If True, a separate model will be trained for each future lag to predict. If False, a single model + is trained to predict all the steps in 'output_chunk_length' (features lags are shifted back by + `output_chunk_length - n` for each step `n`). Default: True. use_static_covariates Whether the model should use static covariate information in case the input `series` passed to ``fit()`` contain static covariates. If ``True``, and static covariates are available at fitting time, will enforce @@ -340,7 +341,7 @@

Source code for darts.models.forecasting.catboost_model

self._median_idx = None self._model_container = None self._rng = None - self.likelihood = likelihood + self._likelihood = likelihood self.quantiles = None self._output_chunk_length = output_chunk_length diff --git a/_modules/darts/models/forecasting/croston.html b/_modules/darts/models/forecasting/croston.html index 6e883535e4..612efca7b3 100644 --- a/_modules/darts/models/forecasting/croston.html +++ b/_modules/darts/models/forecasting/croston.html @@ -34,7 +34,7 @@ - + @@ -178,25 +178,22 @@

Source code for darts.models.forecasting.croston

-------------- """ -from typing import Optional - from statsforecast.models import TSB as CrostonTSB from statsforecast.models import CrostonClassic, CrostonOptimized, CrostonSBA from darts.logging import raise_if, raise_if_not from darts.models.forecasting.forecasting_model import ( - FutureCovariatesLocalForecastingModel, + LocalForecastingModel, ) from darts.timeseries import TimeSeries -
[docs]class Croston(FutureCovariatesLocalForecastingModel): +
[docs]class Croston(LocalForecastingModel): def __init__( self, version: str = "classic", alpha_d: float = None, alpha_p: float = None, - add_encoders: Optional[dict] = None, ): """An implementation of the `Croston method <https://otexts.com/fpp3/counts.html>`_ for intermittent @@ -221,30 +218,6 @@

Source code for darts.models.forecasting.croston

For the "tsb" version, the alpha smoothing parameter to apply on demand. alpha_p For the "tsb" version, the alpha smoothing parameter to apply on probability. - add_encoders - A large number of future covariates can be automatically generated with `add_encoders`. - This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that - will be used as index encoders. Additionally, a transformer such as Darts' :class:`Scaler` can be added to - transform the generated covariates. This happens all under one hood and only needs to be specified at - model creation. - Read :meth:`SequentialEncoder <darts.dataprocessing.encoders.SequentialEncoder>` to find out more about - ``add_encoders``. Default: ``None``. An example showing some of ``add_encoders`` features: - - .. highlight:: python - .. code-block:: python - - def encode_year(idx): - return (idx.year - 1950) / 50 - - add_encoders={ - 'cyclic': {'future': ['month']}, - 'datetime_attribute': {'future': ['hour', 'dayofweek']}, - 'position': {'future': ['relative']}, - 'custom': {'future': [encode_year]}, - 'transformer': Scaler(), - 'tz': 'CET' - } - .. References ---------- @@ -271,7 +244,7 @@

Source code for darts.models.forecasting.croston

[461.7666], [461.7666]]) """ - super().__init__(add_encoders=add_encoders) + super().__init__(add_encoders=None) raise_if_not( version.lower() in ["classic", "optimized", "sba", "tsb"], 'The provided "version" parameter must be set to "classic", "optimized", "sba" or "tsb".', @@ -298,39 +271,32 @@

Source code for darts.models.forecasting.croston

def supports_multivariate(self) -> bool: return False - def _fit(self, series: TimeSeries, future_covariates: Optional[TimeSeries] = None): - super()._fit(series, future_covariates) +
[docs] def fit(self, series: TimeSeries): + super().fit(series) self._assert_univariate(series) series = self.training_series self.model.fit( y=series.values(copy=False).flatten(), - X=( - future_covariates.values(copy=False).flatten() - if future_covariates is not None - else None - ), + # X can be used to passe future covariates only when conformal prediction is used + X=None, ) - return self + return self
- def _predict( +
[docs] def predict( self, n: int, - future_covariates: Optional[TimeSeries] = None, num_samples: int = 1, verbose: bool = False, ): - super()._predict(n, future_covariates, num_samples) + super().predict(n, num_samples) values = self.model.predict( h=n, - X=( - future_covariates.values(copy=False).flatten() - if future_covariates is not None - else None - ), + # X can be used to passe future covariates only when conformal prediction is used + X=None, )["mean"] - return self._build_forecast_series(values) + return self._build_forecast_series(values)
@property def min_train_series_length(self) -> int: diff --git a/_modules/darts/models/forecasting/dlinear.html b/_modules/darts/models/forecasting/dlinear.html index b770729493..0058538197 100644 --- a/_modules/darts/models/forecasting/dlinear.html +++ b/_modules/darts/models/forecasting/dlinear.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/ensemble_model.html b/_modules/darts/models/forecasting/ensemble_model.html index 63b6aff03d..2501a6467d 100644 --- a/_modules/darts/models/forecasting/ensemble_model.html +++ b/_modules/darts/models/forecasting/ensemble_model.html @@ -34,7 +34,7 @@ - + @@ -177,8 +177,9 @@

Source code for darts.models.forecasting.ensemble_model

Ensemble Model Base Class """ +import os from abc import abstractmethod -from typing import List, Optional, Sequence, Tuple, Union +from typing import BinaryIO, List, Optional, Sequence, Tuple, Union from darts.logging import get_logger, raise_if, raise_if_not, raise_log from darts.models.forecasting.forecasting_model import ( @@ -186,9 +187,15 @@

Source code for darts.models.forecasting.ensemble_model

GlobalForecastingModel, LocalForecastingModel, ) +from darts.models.utils import TORCH_AVAILABLE from darts.timeseries import TimeSeries, concatenate from darts.utils.ts_utils import series2seq +if TORCH_AVAILABLE: + from darts.models.forecasting.torch_forecasting_model import TorchForecastingModel +else: + TorchForecastingModel = None + logger = get_logger(__name__) @@ -552,6 +559,74 @@

Source code for darts.models.forecasting.ensemble_model

] return predictions[0] if is_single_series else predictions +
[docs] def save( + self, path: Optional[Union[str, os.PathLike, BinaryIO]] = None, **pkl_kwargs + ) -> None: + """ + Saves the ensemble model under a given path or file handle. + + Additionally, two files are stored for each `TorchForecastingModel` under the forecasting models. + + Example for saving and loading a :class:`RegressionEnsembleModel`: + + .. highlight:: python + .. code-block:: python + + from darts.models import RegressionEnsembleModel, LinearRegressionModel, TiDEModel + + model = RegressionEnsembleModel( + forecasting_models = [ + LinearRegressionModel(lags=4), + TiDEModel(input_chunk_length=4, output_chunk_length=4), + ], + regression_train_n_points=10, + ) + + model.save("my_ensemble_model.pkl") + model_loaded = RegressionEnsembleModel.load("my_ensemble_model.pkl") + .. + + Parameters + ---------- + path + Path or file handle under which to save the ensemble model at its current state. If no path is specified, + the ensemble model is automatically saved under ``"{RegressionEnsembleModel}_{YYYY-mm-dd_HH_MM_SS}.pkl"``. + If the i-th model of `forecasting_models` is a TorchForecastingModel, two files (model object and + checkpoint) are saved under ``"{path}.{ithModelClass}_{i}.pt"`` and ``"{path}.{ithModelClass}_{i}.ckpt"``. + pkl_kwargs + Keyword arguments passed to `pickle.dump()` + """ + + if path is None: + # default path + path = self._default_save_path() + ".pkl" + + super().save(path, **pkl_kwargs) + + for i, m in enumerate(self.forecasting_models): + if TORCH_AVAILABLE and issubclass(type(m), TorchForecastingModel): + path_tfm = f"{path}.{type(m).__name__}_{i}.pt" + m.save(path=path_tfm)
+ +
[docs] @staticmethod + def load(path: Union[str, os.PathLike, BinaryIO]) -> "EnsembleModel": + """ + Loads the ensemble model from a given path or file handle. + + Parameters + ---------- + path + Path or file handle from which to load the ensemble model. + """ + + model: EnsembleModel = GlobalForecastingModel.load(path) + + for i, m in enumerate(model.forecasting_models): + if TORCH_AVAILABLE and issubclass(type(m), TorchForecastingModel): + path_tfm = f"{path}.{type(m).__name__}_{i}.pt" + model.forecasting_models[i] = TorchForecastingModel.load(path_tfm) + return model
+ @property def min_train_series_length(self) -> int: return max(model.min_train_series_length for model in self.forecasting_models) diff --git a/_modules/darts/models/forecasting/exponential_smoothing.html b/_modules/darts/models/forecasting/exponential_smoothing.html index 6db9116a5b..42a8aee3ef 100644 --- a/_modules/darts/models/forecasting/exponential_smoothing.html +++ b/_modules/darts/models/forecasting/exponential_smoothing.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/fft.html b/_modules/darts/models/forecasting/fft.html index 8c4a4a20c7..220cdedf2b 100644 --- a/_modules/darts/models/forecasting/fft.html +++ b/_modules/darts/models/forecasting/fft.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/forecasting_model.html b/_modules/darts/models/forecasting/forecasting_model.html index 2c8ce6e3f5..16ab3cc679 100644 --- a/_modules/darts/models/forecasting/forecasting_model.html +++ b/_modules/darts/models/forecasting/forecasting_model.html @@ -34,7 +34,7 @@ - + @@ -232,7 +232,12 @@

Source code for darts.models.forecasting.forecasting_model

get_single_series, series2seq, ) -from darts.utils.utils import generate_index +from darts.utils.utils import ( + generate_index, + likelihood_component_names, + quantile_interval_names, + quantile_names, +) logger = get_logger(__name__) @@ -929,6 +934,7 @@

Source code for darts.models.forecasting.forecasting_model

Default: ``False`` enable_optimization Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. fit_kwargs Additional arguments passed to the model `fit()` method. predict_kwargs @@ -1368,6 +1374,8 @@

Source code for darts.models.forecasting.forecasting_model

reduction: Union[Callable[..., float], None] = np.mean, verbose: bool = False, show_warnings: bool = True, + predict_likelihood_parameters: bool = False, + enable_optimization: bool = True, metric_kwargs: Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] = None, fit_kwargs: Optional[Dict[str, Any]] = None, predict_kwargs: Optional[Dict[str, Any]] = None, @@ -1487,6 +1495,13 @@

Source code for darts.models.forecasting.forecasting_model

Whether to print progress. show_warnings Whether to show warnings related to parameters `start`, and `train_length`. + predict_likelihood_parameters + If set to `True`, the model predict the parameters of its Likelihood parameters instead of the target. Only + supported for probabilistic models with `likelihood="quantile"`, `num_samples = 1` and + `n<=output_chunk_length`. Default: ``False``. + enable_optimization + Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. metric_kwargs Additional arguments passed to `metric()`, such as `'n_jobs'` for parallelization, `'component_reduction'` for reducing the component wise metrics, seasonality `'m'` for scaled metrics, etc. Will pass arguments to @@ -1518,9 +1533,9 @@

Source code for darts.models.forecasting.forecasting_model

An numpy array of backtest scores. For single series and one of: - a single `metric` function, `historical_forecasts` generated with `last_points_only=False` - and backtest `reduction=None`. The output has shape (n forecasts,). + and backtest `reduction=None`. The output has shape (n forecasts, *). - multiple `metric` functions and `historical_forecasts` generated with `last_points_only=False`. - The output has shape (n metrics,) when using a backtest `reduction`, and (n metrics, n forecasts) + The output has shape (*, n metrics) when using a backtest `reduction`, and (n forecasts, *, n metrics) when `reduction=None` - multiple uni/multivariate series including `series_reduction` and at least one of `component_reduction=None` or `time_reduction=None` for "per time step metrics" @@ -1566,6 +1581,8 @@

Source code for darts.models.forecasting.forecasting_model

last_points_only=last_points_only, verbose=verbose, show_warnings=show_warnings, + predict_likelihood_parameters=predict_likelihood_parameters, + enable_optimization=enable_optimization, fit_kwargs=fit_kwargs, predict_kwargs=predict_kwargs, sample_weight=sample_weight, @@ -1666,22 +1683,24 @@

Source code for darts.models.forecasting.forecasting_model

# get errors for each input `series` backtest_list = [] for i in range(len(cum_len) - 1): - # errors_series with shape `(n metrics, n series specific historical forecasts)` + # errors_series with shape `(n metrics, n series specific historical forecasts, *)` errors_series = errors[:, cum_len[i] : cum_len[i + 1]] if reduction is not None: - # shape `(n metrics, n forecasts)` -> `(n metrics,)` + # shape `(n metrics, n forecasts, *)` -> `(n metrics, *)` errors_series = reduction(errors_series, axis=1) elif last_points_only: - # shape `(n metrics, n forecasts = 1)` -> `(n metrics,)` + # shape `(n metrics, n forecasts = 1, *)` -> `(n metrics, *)` errors_series = errors_series[:, 0] if len(metric) == 1: # shape `(n metrics, *)` -> `(*,)` errors_series = errors_series[0] - elif not last_points_only and reduction is None: + else: # shape `(n metrics, *)` -> `(*, n metrics)` - errors_series = errors_series.T + errors_series = errors_series.transpose( + tuple(i for i in range(1, errors_series.ndim)) + (0,) + ) backtest_list.append(errors_series) return ( @@ -2006,6 +2025,8 @@

Source code for darts.models.forecasting.forecasting_model

metric: METRIC_TYPE = metrics.err, verbose: bool = False, show_warnings: bool = True, + predict_likelihood_parameters: bool = False, + enable_optimization: bool = True, metric_kwargs: Optional[Dict[str, Any]] = None, fit_kwargs: Optional[Dict[str, Any]] = None, predict_kwargs: Optional[Dict[str, Any]] = None, @@ -2124,6 +2145,13 @@

Source code for darts.models.forecasting.forecasting_model

Whether to print progress. show_warnings Whether to show warnings related to parameters `start`, and `train_length`. + predict_likelihood_parameters + If set to `True`, the model predict the parameters of its Likelihood parameters instead of the target. Only + supported for probabilistic models with `likelihood="quantile"`, `num_samples = 1` and + `n<=output_chunk_length`. Default: ``False``. + enable_optimization + Whether to use the optimized version of historical_forecasts when supported and available. + Default: ``True``. metric_kwargs Additional arguments passed to `metric()`, such as `'n_jobs'` for parallelization, `'m'` for scaled metrics, etc. Will pass arguments only if they are present in the corresponding metric signature. Ignores @@ -2179,6 +2207,8 @@

Source code for darts.models.forecasting.forecasting_model

last_points_only=last_points_only, verbose=verbose, show_warnings=show_warnings, + predict_likelihood_parameters=predict_likelihood_parameters, + enable_optimization=enable_optimization, fit_kwargs=fit_kwargs, predict_kwargs=predict_kwargs, overlap_end=False, @@ -2210,9 +2240,10 @@

Source code for darts.models.forecasting.forecasting_model

residuals = [[res] for res in residuals] # sanity check residual output + q, q_interval = metric_kwargs.get("q"), metric_kwargs.get("q_interval") try: - res, fc = residuals[0][0], historical_forecasts[0][0] - _ = np.reshape(res, (len(fc), fc.n_components, 1)) + series_, res, fc = series[0], residuals[0][0], historical_forecasts[0][0] + _ = np.reshape(res, (len(fc), -1, 1)) except Exception as err: raise_log( ValueError( @@ -2226,13 +2257,47 @@

Source code for darts.models.forecasting.forecasting_model

# process residuals residuals_out = [] - for fc_list, res_list in zip(historical_forecasts, residuals): + for series_, fc_list, res_list in zip(series, historical_forecasts, residuals): res_list_out = [] + if q is not None: + q = [q] if isinstance(q, float) else q + # multi-quantile metrics yield more components + comp_names = likelihood_component_names( + components=series_.components, + parameter_names=quantile_names(q), + ) + # `q` and `q_interval` are mutually exclusive + elif q_interval is not None: + # multi-quantile metrics yield more components + q_interval = ( + [q_interval] if isinstance(q_interval, tuple) else q_interval + ) + comp_names = likelihood_component_names( + components=series_.components, + parameter_names=quantile_interval_names(q_interval), + ) + else: + comp_names = None for fc, res in zip(fc_list, res_list): - # make sure all residuals have shape (n time steps, n components, n samples=1) + # make sure all residuals have shape (n time steps, n components * n quantiles, n samples=1) if len(res.shape) != 3: - res = np.reshape(res, (len(fc), fc.n_components, 1)) - res_list_out.append(res if values_only else fc.with_values(res)) + res = np.reshape(res, (len(fc), -1, 1)) + if values_only: + res = res + elif (q is None and q_interval is None) and res.shape[ + 1 + ] == fc.n_components: + res = fc.with_values(res) + else: + # quantile (interval) metrics created different number of components; + # create new series with unknown components + res = TimeSeries.from_times_and_values( + times=fc._time_index, + values=res, + columns=comp_names, + ) + res_list_out.append(res) + residuals_out.append(res_list_out) # if required, reduce to `series` input type diff --git a/_modules/darts/models/forecasting/global_baseline_models.html b/_modules/darts/models/forecasting/global_baseline_models.html index 5b5d638fe5..1b0aa6dbdd 100644 --- a/_modules/darts/models/forecasting/global_baseline_models.html +++ b/_modules/darts/models/forecasting/global_baseline_models.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/kalman_forecaster.html b/_modules/darts/models/forecasting/kalman_forecaster.html index 1412985f8f..552f9eec7e 100644 --- a/_modules/darts/models/forecasting/kalman_forecaster.html +++ b/_modules/darts/models/forecasting/kalman_forecaster.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/lgbm.html b/_modules/darts/models/forecasting/lgbm.html index dd40fe6ed3..5cc068f4f9 100644 --- a/_modules/darts/models/forecasting/lgbm.html +++ b/_modules/darts/models/forecasting/lgbm.html @@ -34,7 +34,7 @@ - + @@ -305,8 +305,9 @@

Source code for darts.models.forecasting.lgbm

Control the randomness in the fitting procedure and for sampling. Default: ``None``. multi_models - If True, a separate model will be trained for each future lag to predict. If False, a single model is - trained to predict at step 'output_chunk_length' in the future. Default: True. + If True, a separate model will be trained for each future lag to predict. If False, a single model + is trained to predict all the steps in 'output_chunk_length' (features lags are shifted back by + `output_chunk_length - n` for each step `n`). Default: True. use_static_covariates Whether the model should use static covariate information in case the input `series` passed to ``fit()`` contain static covariates. If ``True``, and static covariates are available at fitting time, will enforce @@ -363,7 +364,7 @@

Source code for darts.models.forecasting.lgbm

self._median_idx = None self._model_container = None self.quantiles = None - self.likelihood = likelihood + self._likelihood = likelihood self._rng = None # parse likelihood @@ -469,7 +470,6 @@

Source code for darts.models.forecasting.lgbm

val_sample_weight=val_sample_weight, **kwargs, ) - self._model_container[quantile] = self.model return self diff --git a/_modules/darts/models/forecasting/linear_regression_model.html b/_modules/darts/models/forecasting/linear_regression_model.html index 5a0bac62ba..b5770a6121 100644 --- a/_modules/darts/models/forecasting/linear_regression_model.html +++ b/_modules/darts/models/forecasting/linear_regression_model.html @@ -34,7 +34,7 @@ - + @@ -303,8 +303,9 @@

Source code for darts.models.forecasting.linear_regression_model

no `likelihood` is set. Default: ``None``. multi_models - If True, a separate model will be trained for each future lag to predict. If False, a single model is - trained to predict at step 'output_chunk_length' in the future. Default: True. + If True, a separate model will be trained for each future lag to predict. If False, a single model + is trained to predict all the steps in 'output_chunk_length' (features lags are shifted back by + `output_chunk_length - n` for each step `n`). Default: True. use_static_covariates Whether the model should use static covariate information in case the input `series` passed to ``fit()`` contain static covariates. If ``True``, and static covariates are available at fitting time, will enforce @@ -349,7 +350,7 @@

Source code for darts.models.forecasting.linear_regression_model

self._median_idx = None self._model_container = None self.quantiles = None - self.likelihood = likelihood + self._likelihood = likelihood self._rng = None # parse likelihood diff --git a/_modules/darts/models/forecasting/nbeats.html b/_modules/darts/models/forecasting/nbeats.html index 0b9b287217..014579863e 100644 --- a/_modules/darts/models/forecasting/nbeats.html +++ b/_modules/darts/models/forecasting/nbeats.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/nhits.html b/_modules/darts/models/forecasting/nhits.html index 2643d002ff..fc03e82047 100644 --- a/_modules/darts/models/forecasting/nhits.html +++ b/_modules/darts/models/forecasting/nhits.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/nlinear.html b/_modules/darts/models/forecasting/nlinear.html index e3843ac715..179a33ab6d 100644 --- a/_modules/darts/models/forecasting/nlinear.html +++ b/_modules/darts/models/forecasting/nlinear.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/pl_forecasting_module.html b/_modules/darts/models/forecasting/pl_forecasting_module.html index fa6738a258..d2a9ebf3e1 100644 --- a/_modules/darts/models/forecasting/pl_forecasting_module.html +++ b/_modules/darts/models/forecasting/pl_forecasting_module.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/prophet_model.html b/_modules/darts/models/forecasting/prophet_model.html index 04f87f00f8..3546e82ecb 100644 --- a/_modules/darts/models/forecasting/prophet_model.html +++ b/_modules/darts/models/forecasting/prophet_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/random_forest.html b/_modules/darts/models/forecasting/random_forest.html index 1fa6d9ee49..2d26349f44 100644 --- a/_modules/darts/models/forecasting/random_forest.html +++ b/_modules/darts/models/forecasting/random_forest.html @@ -34,7 +34,7 @@ - + @@ -300,8 +300,9 @@

Source code for darts.models.forecasting.random_forest

The maximum depth of the tree. If None, then nodes are expanded until all leaves are pure or until all leaves contain less than min_samples_split samples. multi_models - If True, a separate model will be trained for each future lag to predict. If False, a single model is - trained to predict at step 'output_chunk_length' in the future. Default: True. + If True, a separate model will be trained for each future lag to predict. If False, a single model + is trained to predict all the steps in 'output_chunk_length' (features lags are shifted back by + `output_chunk_length - n` for each step `n`). Default: True. use_static_covariates Whether the model should use static covariate information in case the input `series` passed to ``fit()`` contain static covariates. If ``True``, and static covariates are available at fitting time, will enforce diff --git a/_modules/darts/models/forecasting/regression_ensemble_model.html b/_modules/darts/models/forecasting/regression_ensemble_model.html index a06992da05..d6a595f49d 100644 --- a/_modules/darts/models/forecasting/regression_ensemble_model.html +++ b/_modules/darts/models/forecasting/regression_ensemble_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/regression_model.html b/_modules/darts/models/forecasting/regression_model.html index 3f31d13c7a..457a57bc23 100644 --- a/_modules/darts/models/forecasting/regression_model.html +++ b/_modules/darts/models/forecasting/regression_model.html @@ -34,7 +34,7 @@ - + @@ -213,6 +213,7 @@

Source code for darts.models.forecasting.regression_model

import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression +from sklearn.utils.validation import has_fit_parameter from darts.logging import get_logger, raise_if, raise_if_not, raise_log from darts.models.forecasting.forecasting_model import GlobalForecastingModel @@ -230,7 +231,11 @@

Source code for darts.models.forecasting.regression_model

) from darts.utils.multioutput import MultiOutputRegressor from darts.utils.ts_utils import get_single_series, seq2series, series2seq -from darts.utils.utils import _check_quantiles +from darts.utils.utils import ( + _check_quantiles, + likelihood_component_names, + quantile_names, +) logger = get_logger(__name__) @@ -335,8 +340,9 @@

Source code for darts.models.forecasting.regression_model

will be used per component in the multivariate series. If None, defaults to: ``sklearn.linear_model.LinearRegression(n_jobs=-1)``. multi_models - If True, a separate model will be trained for each future lag to predict. If False, a single model is - trained to predict at step 'output_chunk_length' in the future. Default: True. + If True, a separate model will be trained for each future lag to predict. If False, a single model + is trained to predict all the steps in 'output_chunk_length' (features lags are shifted back by + `output_chunk_length - n` for each step `n`). Default: True. use_static_covariates Whether the model should use static covariate information in case the input `series` passed to ``fit()`` contain static covariates. If ``True``, and static covariates are available at fitting time, will enforce @@ -876,8 +882,19 @@

Source code for darts.models.forecasting.regression_model

val_sample_weight=val_sample_weight, max_samples_per_ts=max_samples_per_ts, ) + + # only use `sample_weight` if model supports it + sample_weight_kwargs = dict() + if sample_weights is not None: + if self.supports_sample_weight: + sample_weight_kwargs = {"sample_weight": sample_weights} + else: + logger.warning( + "`sample_weight` was ignored since underlying regression model's " + "`fit()` method does not support it." + ) self.model.fit( - training_samples, training_labels, sample_weight=sample_weights, **kwargs + training_samples, training_labels, **sample_weight_kwargs, **kwargs ) # generate and store the lagged components names (for feature importance analysis) @@ -1006,30 +1023,42 @@

Source code for darts.models.forecasting.regression_model

} # if multi-output regression + use_mor = False if not series[0].is_univariate or ( self.output_chunk_length > 1 and self.multi_models and not isinstance(self.model, MultiOutputRegressor) ): - val_set_name, val_weight_name = self.val_set_params - mor_kwargs = { - "eval_set_name": val_set_name, - "eval_weight_name": val_weight_name, - "n_jobs": n_jobs_multioutput_wrapper, - } if sample_weight is not None: # we have 2D sample (and time) weights, only supported in Darts - self.model = MultiOutputRegressor(self.model, **mor_kwargs) + use_mor = True elif not ( callable(getattr(self.model, "_get_tags", None)) and isinstance(self.model._get_tags(), dict) and self.model._get_tags().get("multioutput") ): # model does not support multi-output regression natively - self.model = MultiOutputRegressor(self.model, **mor_kwargs) - elif self.model.__class__.__name__ == "CatBoostRegressor": - if self.model.get_params()["loss_function"] == "RMSEWithUncertainty": - self.model = MultiOutputRegressor(self.model, **mor_kwargs) + use_mor = True + elif ( + self.model.__class__.__name__ == "CatBoostRegressor" + and self.model.get_params()["loss_function"] == "RMSEWithUncertainty" + ): + use_mor = True + elif ( + self.model.__class__.__name__ == "XGBRegressor" + and self.likelihood is not None + ): + # since xgboost==2.1.0, likelihoods do not support native multi output regression + use_mor = True + + if use_mor: + val_set_name, val_weight_name = self.val_set_params + mor_kwargs = { + "eval_set_name": val_set_name, + "eval_weight_name": val_weight_name, + "n_jobs": n_jobs_multioutput_wrapper, + } + self.model = MultiOutputRegressor(self.model, **mor_kwargs) # warn if n_jobs_multioutput_wrapper was provided but not used if ( @@ -1289,10 +1318,18 @@

Source code for darts.models.forecasting.regression_model

# same for covariate matrices for cov_type, data in covariate_matrices.items(): covariate_matrices[cov_type] = np.repeat(data, num_samples, axis=0) + + # for concatenating target with predictions (or quantile parameters) + if predict_likelihood_parameters and self.likelihood is not None: + # with `multi_models=False`, the predictions are concatenated with the past target, even if `n<=ocl` + # to make things work, we just append the first predicted parameter (it will never be accessed) + sample_slice = slice(0, None, self.num_parameters) + else: + sample_slice = slice(None) + # prediction predictions = [] last_step_shift = 0 - # t_pred indicates the number of time steps after the first prediction for t_pred in range(0, n, step): # in case of autoregressive forecast `(t_pred > 0)` and if `n` is not a round multiple of `step`, @@ -1303,7 +1340,9 @@

Source code for darts.models.forecasting.regression_model

# concatenate previous iteration forecasts if "target" in self.lags and predictions: - series_matrix = np.concatenate([series_matrix, predictions[-1]], axis=1) + series_matrix = np.concatenate( + [series_matrix, predictions[-1][:, :, sample_slice]], axis=1 + ) # extract and concatenate lags from target and covariates series X = _create_lagged_data_autoregression( @@ -1401,6 +1440,10 @@

Source code for darts.models.forecasting.regression_model

def __str__(self): return self.model.__str__() + @property + def likelihood(self) -> Optional[str]: + return getattr(self, "_likelihood", None) + @property def supports_past_covariates(self) -> bool: return len(self.lags.get("past", [])) > 0 @@ -1418,6 +1461,15 @@

Source code for darts.models.forecasting.regression_model

"""Whether the model supports a validation set during training.""" return False + @property + def supports_sample_weight(self) -> bool: + """Whether the model supports a validation set during training.""" + return ( + self.model.supports_sample_weight + if isinstance(self.model, MultiOutputRegressor) + else has_fit_parameter(self.model, "sample_weight") + ) + @property def val_set_params(self) -> Tuple[Optional[str], Optional[str]]: """Returns the parameter names for the validation set, and validation sample weights if it supports @@ -1805,17 +1857,15 @@

Source code for darts.models.forecasting.regression_model

) -> List[str]: return self._likelihood_generate_components_names( input_series, - [f"q{quantile:.2f}" for quantile in self._model_container.keys()], + quantile_names(q=self._model_container.keys()), ) def _likelihood_generate_components_names( self, input_series: TimeSeries, parameter_names: List[str] ) -> List[str]: - return [ - f"{tgt_name}_{param_n}" - for tgt_name in input_series.components - for param_n in parameter_names - ] + return likelihood_component_names( + components=input_series.components, parameter_names=parameter_names + ) class _QuantileModelContainer(OrderedDict): diff --git a/_modules/darts/models/forecasting/rnn_model.html b/_modules/darts/models/forecasting/rnn_model.html index 1d28cb042b..cf807df2f5 100644 --- a/_modules/darts/models/forecasting/rnn_model.html +++ b/_modules/darts/models/forecasting/rnn_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/sf_auto_arima.html b/_modules/darts/models/forecasting/sf_auto_arima.html index 610481cc68..78fd0348c4 100644 --- a/_modules/darts/models/forecasting/sf_auto_arima.html +++ b/_modules/darts/models/forecasting/sf_auto_arima.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/sf_auto_ces.html b/_modules/darts/models/forecasting/sf_auto_ces.html index 6fad757121..662b2a54f8 100644 --- a/_modules/darts/models/forecasting/sf_auto_ces.html +++ b/_modules/darts/models/forecasting/sf_auto_ces.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/sf_auto_ets.html b/_modules/darts/models/forecasting/sf_auto_ets.html index 9f2c2a0b31..c9a92b6a45 100644 --- a/_modules/darts/models/forecasting/sf_auto_ets.html +++ b/_modules/darts/models/forecasting/sf_auto_ets.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/sf_auto_theta.html b/_modules/darts/models/forecasting/sf_auto_theta.html index 530ef56b16..68c0b241b2 100644 --- a/_modules/darts/models/forecasting/sf_auto_theta.html +++ b/_modules/darts/models/forecasting/sf_auto_theta.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/tbats_model.html b/_modules/darts/models/forecasting/tbats_model.html index bafdf633f8..03eb2d528e 100644 --- a/_modules/darts/models/forecasting/tbats_model.html +++ b/_modules/darts/models/forecasting/tbats_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/tcn_model.html b/_modules/darts/models/forecasting/tcn_model.html index 3163d4e516..79dc02443f 100644 --- a/_modules/darts/models/forecasting/tcn_model.html +++ b/_modules/darts/models/forecasting/tcn_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/tft_model.html b/_modules/darts/models/forecasting/tft_model.html index 2dc9d85e2c..88971621f2 100644 --- a/_modules/darts/models/forecasting/tft_model.html +++ b/_modules/darts/models/forecasting/tft_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/tft_submodels.html b/_modules/darts/models/forecasting/tft_submodels.html index fe039b33c1..54fed60db1 100644 --- a/_modules/darts/models/forecasting/tft_submodels.html +++ b/_modules/darts/models/forecasting/tft_submodels.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/theta.html b/_modules/darts/models/forecasting/theta.html index c98d44eddc..882efb1206 100644 --- a/_modules/darts/models/forecasting/theta.html +++ b/_modules/darts/models/forecasting/theta.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/tide_model.html b/_modules/darts/models/forecasting/tide_model.html index 6ee692dd4e..d40550987b 100644 --- a/_modules/darts/models/forecasting/tide_model.html +++ b/_modules/darts/models/forecasting/tide_model.html @@ -34,7 +34,7 @@ - + @@ -256,6 +256,8 @@

Source code for darts.models.forecasting.tide_model

temporal_width_future: int, use_layer_norm: bool, dropout: float, + temporal_hidden_size_past: Optional[int] = None, + temporal_hidden_size_future: Optional[int] = None, **kwargs, ): """Pytorch module implementing the TiDE architecture. @@ -286,6 +288,10 @@

Source code for darts.models.forecasting.tide_model

The width of the past covariate embedding space. temporal_width_future The width of the future covariate embedding space. + temporal_hidden_size_past + The width of the hidden layers in the past covariate projection Residual Block. + temporal_hidden_size_future + The width of the hidden layers in the future covariate projection Residual Block. use_layer_norm Whether to use layer normalization in the Residual Blocks. dropout @@ -323,6 +329,8 @@

Source code for darts.models.forecasting.tide_model

self.dropout = dropout self.temporal_width_past = temporal_width_past self.temporal_width_future = temporal_width_future + self.temporal_hidden_size_past = temporal_hidden_size_past or hidden_size + self.temporal_hidden_size_future = temporal_hidden_size_future or hidden_size # past covariates handling: either feature projection, raw features, or no features self.past_cov_projection = None @@ -331,7 +339,7 @@

Source code for darts.models.forecasting.tide_model

self.past_cov_projection = _ResidualBlock( input_dim=self.past_cov_dim, output_dim=temporal_width_past, - hidden_size=hidden_size, + hidden_size=temporal_hidden_size_past, use_layer_norm=use_layer_norm, dropout=dropout, ) @@ -349,7 +357,7 @@

Source code for darts.models.forecasting.tide_model

self.future_cov_projection = _ResidualBlock( input_dim=future_cov_dim, output_dim=temporal_width_future, - hidden_size=hidden_size, + hidden_size=temporal_hidden_size_future, use_layer_norm=use_layer_norm, dropout=dropout, ) @@ -550,6 +558,8 @@

Source code for darts.models.forecasting.tide_model

hidden_size: int = 128, temporal_width_past: int = 4, temporal_width_future: int = 4, + temporal_hidden_size_past: int = None, + temporal_hidden_size_future: int = None, temporal_decoder_hidden: int = 32, use_layer_norm: bool = False, dropout: float = 0.1, @@ -599,11 +609,19 @@

Source code for darts.models.forecasting.tide_model

hidden_size The width of the layers in the residual blocks of the encoder and decoder. temporal_width_past - The width of the layers in the past covariate projection residual block. If `0`, + The width of the output layer in the past covariate projection residual block. If `0`, will bypass feature projection and use the raw feature data. temporal_width_future - The width of the layers in the future covariate projection residual block. If `0`, + The width of the output layer in the future covariate projection residual block. If `0`, will bypass feature projection and use the raw feature data. + temporal_hidden_size_past + The width of the hidden layer in the past covariate projection residual block. If not specified, + defaults to `hidden_size`, which is the width of the hidden layer in the encoder and decoder. + This is likely to be too large in many cases, so it is recommended to set this parameter explicitly. + temporal_hidden_size_future + The width of the hidden layer in the future covariate projection residual block. If not specified, + defaults to `hidden_size`, which is the width of the hidden layer in the encoder and decoder. + This is likely to be too large in many cases, so it is recommended to set this parameter explicitly. temporal_decoder_hidden The width of the layers in the temporal decoder. use_layer_norm @@ -801,6 +819,8 @@

Source code for darts.models.forecasting.tide_model

self.hidden_size = hidden_size self.temporal_width_past = temporal_width_past self.temporal_width_future = temporal_width_future + self.temporal_hidden_size_past = temporal_hidden_size_past or hidden_size + self.temporal_hidden_size_future = temporal_hidden_size_future or hidden_size self.temporal_decoder_hidden = temporal_decoder_hidden self._considers_static_covariates = use_static_covariates @@ -868,6 +888,8 @@

Source code for darts.models.forecasting.tide_model

hidden_size=self.hidden_size, temporal_width_past=self.temporal_width_past, temporal_width_future=self.temporal_width_future, + temporal_hidden_size_past=self.temporal_hidden_size_past, + temporal_hidden_size_future=self.temporal_hidden_size_future, temporal_decoder_hidden=self.temporal_decoder_hidden, use_layer_norm=self.use_layer_norm, dropout=self.dropout, @@ -880,7 +902,15 @@

Source code for darts.models.forecasting.tide_model

@property def supports_multivariate(self) -> bool: - return True
+ return True + + def _check_ckpt_parameters(self, tfm_save): + # new parameters were added that will break loading weights + new_params = ["temporal_hidden_size_past", "temporal_hidden_size_future"] + for param in new_params: + if param not in tfm_save.model_params: + tfm_save.model_params[param] = None + super()._check_ckpt_parameters(tfm_save)
diff --git a/_modules/darts/models/forecasting/transformer_model.html b/_modules/darts/models/forecasting/transformer_model.html index 532bf5d0e8..1cb900843a 100644 --- a/_modules/darts/models/forecasting/transformer_model.html +++ b/_modules/darts/models/forecasting/transformer_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/tsmixer_model.html b/_modules/darts/models/forecasting/tsmixer_model.html index 80b2d7f92a..51cf115d32 100644 --- a/_modules/darts/models/forecasting/tsmixer_model.html +++ b/_modules/darts/models/forecasting/tsmixer_model.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/varima.html b/_modules/darts/models/forecasting/varima.html index 18a04adcf3..07460066e2 100644 --- a/_modules/darts/models/forecasting/varima.html +++ b/_modules/darts/models/forecasting/varima.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/models/forecasting/xgboost.html b/_modules/darts/models/forecasting/xgboost.html index 152de4e6c5..90df45ef5d 100644 --- a/_modules/darts/models/forecasting/xgboost.html +++ b/_modules/darts/models/forecasting/xgboost.html @@ -34,7 +34,7 @@ - + @@ -323,8 +323,9 @@

Source code for darts.models.forecasting.xgboost

Control the randomness in the fitting procedure and for sampling. Default: ``None``. multi_models - If True, a separate model will be trained for each future lag to predict. If False, a single model is - trained to predict at step 'output_chunk_length' in the future. Default: True. + If True, a separate model will be trained for each future lag to predict. If False, a single model + is trained to predict all the steps in 'output_chunk_length' (features lags are shifted back by + `output_chunk_length - n` for each step `n`). Default: True. use_static_covariates Whether the model should use static covariate information in case the input `series` passed to ``fit()`` contain static covariates. If ``True``, and static covariates are available at fitting time, will enforce @@ -368,7 +369,7 @@

Source code for darts.models.forecasting.xgboost

self._median_idx = None self._model_container = None self.quantiles = None - self.likelihood = likelihood + self._likelihood = likelihood self._rng = None # parse likelihood diff --git a/_modules/darts/models/utils.html b/_modules/darts/models/utils.html index 266c25473d..50dc272405 100644 --- a/_modules/darts/models/utils.html +++ b/_modules/darts/models/utils.html @@ -34,7 +34,7 @@ - + @@ -177,6 +177,13 @@

Source code for darts.models.utils

 
 logger = get_logger(__name__)
 
+try:
+    import torch  # noqa: F401
+
+    TORCH_AVAILABLE = True
+except ImportError:
+    TORCH_AVAILABLE = False
+
 
 
[docs]class NotImportedModule: """Helper class for handling import errors of optional dependencies.""" diff --git a/_modules/darts/timeseries.html b/_modules/darts/timeseries.html index cb4bd40561..5caf75978e 100644 --- a/_modules/darts/timeseries.html +++ b/_modules/darts/timeseries.html @@ -34,7 +34,7 @@ - + @@ -215,6 +215,7 @@

Source code for darts.timeseries

 from collections import defaultdict
 from copy import deepcopy
 from inspect import signature
+from io import StringIO
 from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
 
 import matplotlib.axes
@@ -227,7 +228,11 @@ 

Source code for darts.timeseries

 
 from darts.logging import get_logger, raise_if, raise_if_not, raise_log
 from darts.utils import _build_tqdm_iterator, _parallel_apply
-from darts.utils.utils import expand_arr, generate_index, n_steps_between
+from darts.utils.utils import (
+    expand_arr,
+    generate_index,
+    n_steps_between,
+)
 
 try:
     from typing import Literal
@@ -244,6 +249,7 @@ 

Source code for darts.timeseries

 # dimension names in the DataArray
 # the "time" one can be different, if it has a name in the underlying Series/DataFrame.
 DIMS = ("time", "component", "sample")
+AXES = {"time": 0, "component": 1, "sample": 2}
 
 VALID_INDEX_TYPES = (pd.DatetimeIndex, pd.RangeIndex)
 STATIC_COV_TAG = "static_covariates"
@@ -1039,11 +1045,25 @@ 

Source code for darts.timeseries

 
         df = df[static_cov_cols + extract_value_cols + extract_time_col]
 
-        # sort on entire `df` to avoid having to sort individually later on
         if time_col:
-            df.index = pd.DatetimeIndex(df[time_col])
-            df = df.drop(columns=time_col)
-        df = df.sort_index()
+            if np.issubdtype(df[time_col].dtype, object) or np.issubdtype(
+                df[time_col].dtype, np.datetime64
+            ):
+                df.index = pd.DatetimeIndex(df[time_col])
+                df = df.drop(columns=time_col)
+            else:
+                df = df.set_index(time_col)
+
+        if df.index.is_monotonic_increasing:
+            logger.warning(
+                "UserWarning: The (time) index from `df` is monotonically increasing. This "
+                "results in time series groups with non-overlapping (time) index. You can ignore this warning if the "
+                "index represents the actual index of each individual time series group."
+            )
+
+        # sort on entire `df` to avoid having to sort individually later on
+        else:
+            df = df.sort_index()
 
         groups = df.groupby(group_cols[0] if len(group_cols) == 1 else group_cols)
 
@@ -1422,7 +1442,7 @@ 

Source code for darts.timeseries

         TimeSeries
             The time series object converted from the JSON String
         """
-        df = pd.read_json(json_str, orient="split")
+        df = pd.read_json(StringIO(json_str), orient="split")
         return cls.from_dataframe(
             df, static_covariates=static_covariates, hierarchy=hierarchy
         )
@@ -1517,15 +1537,20 @@

Source code for darts.timeseries

             else None
         )
 
+    @property
+    def shape(self) -> Tuple[int]:
+        """The shape of the series (n_timesteps, n_components, n_samples)."""
+        return self._xa.shape
+
     @property
     def n_samples(self) -> int:
         """Number of samples contained in the series."""
-        return len(self._xa.sample)
+        return self.shape[AXES["sample"]]
 
     @property
     def n_components(self) -> int:
         """Number of components (dimensions) contained in the series."""
-        return len(self._xa.component)
+        return self.shape[AXES["component"]]
 
     @property
     def width(self) -> int:
@@ -1535,12 +1560,12 @@ 

Source code for darts.timeseries

     @property
     def n_timesteps(self) -> int:
         """Number of time steps in the series."""
-        return len(self._time_index)
+        return self.shape[AXES["time"]]
 
     @property
     def is_deterministic(self) -> bool:
         """Whether this series is deterministic."""
-        return self.n_samples == 1
+        return self.shape[AXES["sample"]] == 1
 
     @property
     def is_stochastic(self) -> bool:
@@ -1555,7 +1580,7 @@ 

Source code for darts.timeseries

     @property
     def is_univariate(self) -> bool:
         """Whether this series is univariate."""
-        return self.n_components == 1
+        return self.shape[AXES["component"]] == 1
 
     @property
     def freq(self) -> Union[pd.DateOffset, int]:
@@ -3015,10 +3040,10 @@ 

Source code for darts.timeseries

             "Both series must have the same number of components.",
             logger,
         )
-        if self._has_datetime_index:
+        if len(self) > 0 and len(other) > 0:
             raise_if_not(
                 other.start_time() == self.end_time() + self.freq,
-                "Appended TimeSeries must start one time step after current one.",
+                "Appended TimeSeries must start one (time) step after current one.",
                 logger,
             )
 
@@ -3052,17 +3077,28 @@ 

Source code for darts.timeseries

         TimeSeries
             A new TimeSeries with the new values appended
         """
-        if self._has_datetime_index:
-            idx = pd.DatetimeIndex(
-                [self.end_time() + i * self._freq for i in range(1, len(values) + 1)],
-                freq=self._freq,
-            )
-        else:
-            idx = pd.RangeIndex(
-                start=self.end_time() + self._freq,
-                stop=self.end_time() + (len(values) + 1) * self._freq,
-                step=self._freq,
+        if len(values) == 0:
+            return self.copy()
+
+        values = np.array(values) if not isinstance(values, np.ndarray) else values
+        values = expand_arr(values, ndim=len(DIMS))
+        if not values.shape[1:] == self._xa.values.shape[1:]:
+            raise_log(
+                ValueError(
+                    f"The (expanded) values must have the same number of components and samples "
+                    f"(second and third dims) as the series to append to. "
+                    f"Received shape: {values.shape}, expected: {self._xa.values.shape}"
+                ),
+                logger=logger,
             )
+
+        idx = generate_index(
+            start=self.end_time() + self.freq,
+            length=len(values),
+            freq=self.freq,
+            name=self._time_index.name,
+        )
+
         return self.append(
             self.__class__.from_times_and_values(
                 values=values,
@@ -3111,22 +3147,28 @@ 

Source code for darts.timeseries

         TimeSeries
             A new TimeSeries with the new values prepended.
         """
+        if len(values) == 0:
+            return self.copy()
 
-        if self._has_datetime_index:
-            idx = pd.DatetimeIndex(
-                [
-                    self.start_time() - i * self._freq
-                    for i in reversed(range(1, len(values) + 1))
-                ],
-                freq=self._freq,
-            )
-        else:
-            idx = pd.RangeIndex(
-                self.start_time() - self.freq * len(values),
-                self.start_time(),
-                step=self.freq,
+        values = np.array(values) if not isinstance(values, np.ndarray) else values
+        values = expand_arr(values, ndim=len(DIMS))
+        if not values.shape[1:] == self._xa.values.shape[1:]:
+            raise_log(
+                ValueError(
+                    f"The (expanded) values must have the same number of components and samples "
+                    f"(second and third dims) as the series to prepend to. "
+                    f"Received shape: {values.shape}, expected: {self._xa.values.shape}"
+                ),
+                logger=logger,
             )
 
+        idx = generate_index(
+            end=self.start_time() - self.freq,
+            length=len(values),
+            freq=self.freq,
+            name=self._time_index.name,
+        )
+
         return self.prepend(
             self.__class__.from_times_and_values(
                 values=values,
@@ -3415,6 +3457,12 @@ 

Source code for darts.timeseries

 
         This works only for deterministic time series (i.e., made of 1 sample).
 
+        Notes
+        -----
+        0-indexing is enforced across all the encodings, see
+        :meth:`datetime_attribute_timeseries() <darts.utils.timeseries_generation.datetime_attribute_timeseries>`
+        for more information.
+
         Parameters
         ----------
         attribute
@@ -3493,7 +3541,9 @@ 

Source code for darts.timeseries

             )
         )
-
[docs] def resample(self, freq: str, method: str = "pad", **kwargs) -> Self: +
[docs] def resample( + self, freq: Union[str, pd.DateOffset], method: str = "pad", **kwargs + ) -> Self: """ Build a reindexed ``TimeSeries`` with a given frequency. Provided method is used to fill holes in reindexed TimeSeries, by default 'pad'. @@ -3502,7 +3552,7 @@

Source code for darts.timeseries

         ----------
         freq
             The new time difference between two adjacent entries in the returned TimeSeries.
-            A DateOffset alias is expected.
+            Expects a `pandas.DateOffset` or `DateOffset` alias.
         method:
             Method to fill holes in reindexed TimeSeries (note this does not fill NaNs that already were present):
 
@@ -3545,6 +3595,8 @@ 

Source code for darts.timeseries

         TimeSeries
             A reindexed TimeSeries with given frequency.
         """
+        if isinstance(freq, pd.DateOffset):
+            freq = freq.freqstr
 
         resample = self._xa.resample(
             indexer={self._time_dim: freq},
@@ -4320,8 +4372,6 @@ 

Source code for darts.timeseries

                 central_series = comp.mean(dim=DIMS[2])
 
             alpha = kwargs["alpha"] if "alpha" in kwargs else None
-            if not self.is_deterministic:
-                kwargs["alpha"] = 1
             if custom_labels:
                 label_to_use = label[i]
             else:
@@ -4333,15 +4383,18 @@ 

Source code for darts.timeseries

                     label_to_use = f"{label}_{comp_name}"
             kwargs["label"] = label_to_use
 
+            kwargs_central = deepcopy(kwargs)
+            if not self.is_deterministic:
+                kwargs_central["alpha"] = 1
             if central_series.shape[0] > 1:
-                p = central_series.plot(*args, ax=ax, **kwargs)
+                p = central_series.plot(*args, ax=ax, **kwargs_central)
             # empty TimeSeries
             elif central_series.shape[0] == 0:
                 p = ax.plot(
                     [],
                     [],
                     *args,
-                    **kwargs,
+                    **kwargs_central,
                 )
                 ax.set_xlabel(self.time_index.name)
             else:
@@ -4350,7 +4403,7 @@ 

Source code for darts.timeseries

                     central_series.values[0],
                     "o",
                     *args,
-                    **kwargs,
+                    **kwargs_central,
                 )
             color_used = p[0].get_color() if default_formatting else None
 
@@ -4774,11 +4827,24 @@ 

Source code for darts.timeseries

         else:
             other_vals = other
 
-        raise_if_not(
-            self._xa.values.shape == other_vals.shape,
-            "Attempted to perform operation on two TimeSeries of unequal shapes.",
-            logger,
-        )
+        t, c, s = self._xa.shape
+        other_shape = other_vals.shape
+        if not (
+            # can combine arrays if shapes are equal (t, c, s)
+            other_shape == (t, c, s)
+            # or broadcast [t, 1, 1] onto [t, c, s]
+            or other_shape == (t, 1, 1)
+            # or broadcast [t, c, 1] onto [t, c, s]
+            or other_shape == (t, c, 1)
+            # or broadcast [t, 1, s] onto [t, c, s]
+            or other_shape == (t, 1, s),
+        ):
+            raise_log(
+                ValueError(
+                    "Attempted to perform operation on two TimeSeries of unequal shapes."
+                ),
+                logger=logger,
+            )
         new_xa = self._xa.copy()
         new_xa.values = combine_fn(new_xa.values, other_vals)
         return self.__class__(new_xa)
@@ -5154,12 +5220,18 @@ 

Source code for darts.timeseries

             )
             return self.__class__(xa_)
         elif isinstance(other, (TimeSeries, xr.DataArray, np.ndarray)):
-            if not (other.all_values(copy=False) != 0).all():
+            if isinstance(other, TimeSeries):
+                other_vals = other.data_array(copy=False).values
+            elif isinstance(other, xr.DataArray):
+                other_vals = other.values
+            else:
+                other_vals = other
+            if not (other_vals != 0).all():
                 raise_log(
                     ZeroDivisionError("Cannot divide by a TimeSeries with a value 0."),
                     logger,
                 )
-            return self._combine_arrays(other, lambda s1, s2: s1 / s2)
+            return self._combine_arrays(other_vals, lambda s1, s2: s1 / s2)
         else:
             raise_log(
                 TypeError(
diff --git a/_modules/darts/utils/callbacks.html b/_modules/darts/utils/callbacks.html
index d3524506ec..ac98990fdf 100644
--- a/_modules/darts/utils/callbacks.html
+++ b/_modules/darts/utils/callbacks.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/utils/data/horizon_based_dataset.html b/_modules/darts/utils/data/horizon_based_dataset.html
index 109861ccf2..1a03fb3e1e 100644
--- a/_modules/darts/utils/data/horizon_based_dataset.html
+++ b/_modules/darts/utils/data/horizon_based_dataset.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/utils/data/inference_dataset.html b/_modules/darts/utils/data/inference_dataset.html
index ada2f5e61c..97e0730903 100644
--- a/_modules/darts/utils/data/inference_dataset.html
+++ b/_modules/darts/utils/data/inference_dataset.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/utils/data/sequential_dataset.html b/_modules/darts/utils/data/sequential_dataset.html
index a9d5cb7ce6..3c21d934ec 100644
--- a/_modules/darts/utils/data/sequential_dataset.html
+++ b/_modules/darts/utils/data/sequential_dataset.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/utils/data/shifted_dataset.html b/_modules/darts/utils/data/shifted_dataset.html
index a56722638b..bd28dc3b83 100644
--- a/_modules/darts/utils/data/shifted_dataset.html
+++ b/_modules/darts/utils/data/shifted_dataset.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
diff --git a/_modules/darts/utils/data/tabularization.html b/_modules/darts/utils/data/tabularization.html
index 7d4149407a..4049872d91 100644
--- a/_modules/darts/utils/data/tabularization.html
+++ b/_modules/darts/utils/data/tabularization.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
@@ -218,6 +218,7 @@ 

Source code for darts.utils.data.tabularization

< is_training: bool = True, concatenate: bool = True, sample_weight: Optional[Union[str, TimeSeries, Sequence[TimeSeries]]] = None, + show_warnings: bool = True, ) -> Tuple[ ArrayOrArraySequence, Union[None, ArrayOrArraySequence], @@ -399,6 +400,8 @@

Source code for darts.utils.data.tabularization

< `"linear"` or `"exponential"` decay - the further in the past, the lower the weight. The weights are computed globally based on the length of the longest series in `series`. Then for each series, the weights are extracted from the end of the global weights. This gives a common time weighting across all series. + show_warnings + Whether to show warnings. Returns ------- @@ -534,6 +537,7 @@

Source code for darts.utils.data.tabularization

< multi_models=multi_models, check_inputs=check_inputs, is_training=is_training, + show_warnings=show_warnings, ) else: X_i, y_i, times_i, weights_i = _create_lagged_data_by_intersecting_times( @@ -550,6 +554,7 @@

Source code for darts.utils.data.tabularization

< multi_models=multi_models, check_inputs=check_inputs, is_training=is_training, + show_warnings=show_warnings, ) X_i, last_static_covariates_shape = add_static_covariates_to_lagged_data( features=X_i, @@ -751,6 +756,7 @@

Source code for darts.utils.data.tabularization

< check_inputs: bool = True, use_moving_windows: bool = True, concatenate: bool = True, + show_warnings: bool = True, ) -> Tuple[ArrayOrArraySequence, Sequence[pd.Index]]: """ Creates the features array `X` to produce a series of prediction from an already-trained regression model; the @@ -815,6 +821,8 @@

Source code for darts.utils.data.tabularization

< `Sequence[TimeSeries]` are provided, then `X` will be an array created by concatenating all feature arrays formed by each `TimeSeries` along the `0`th axis. Note that `times` is still returned as `Sequence[pd.Index]`, even when `concatenate = True`. + show_warnings + Whether to show warnings. Returns ------- @@ -855,6 +863,7 @@

Source code for darts.utils.data.tabularization

< use_moving_windows=use_moving_windows, is_training=False, concatenate=concatenate, + show_warnings=show_warnings, ) return X, times
@@ -1138,6 +1147,7 @@

Source code for darts.utils.data.tabularization

< multi_models: bool, check_inputs: bool, is_training: bool, + show_warnings: bool = True, ) -> Tuple[np.ndarray, Optional[np.ndarray], pd.Index, Optional[np.ndarray]]: """ Helper function called by `create_lagged_data` that computes `X`, `y`, and `times` by @@ -1166,6 +1176,7 @@

Source code for darts.utils.data.tabularization

< is_training=is_training, return_min_and_max_lags=True, check_inputs=check_inputs, + show_warnings=show_warnings, ) if check_inputs: series_and_lags_not_specified = [max_lag is None for max_lag in max_lags] @@ -1372,6 +1383,7 @@

Source code for darts.utils.data.tabularization

< multi_models: bool, check_inputs: bool, is_training: bool, + show_warnings: bool = True, ) -> Tuple[ np.ndarray, Optional[np.ndarray], @@ -1399,6 +1411,7 @@

Source code for darts.utils.data.tabularization

< is_training=is_training, return_min_and_max_lags=True, check_inputs=check_inputs, + show_warnings=show_warnings, ) if check_inputs: series_and_lags_not_specified = [min_lag is None for min_lag in min_lags] @@ -1635,6 +1648,7 @@

Source code for darts.utils.data.tabularization

< is_training: bool = True, return_min_and_max_lags: bool = False, check_inputs: bool = True, + show_warnings: bool = True, ) -> Union[FeatureTimes, Tuple[FeatureTimes, MinLags, MaxLags]]: """ Returns a tuple containing the times in `target_series`, the times in `past_covariates`, and the times in @@ -1746,6 +1760,8 @@

Source code for darts.utils.data.tabularization

< return_min_and_max_lags Optionally, specifies whether the largest magnitude lag value for each series should also be returned along with the 'eligible' feature times + show_warnings + Whether to show warnings. Note: if the lags are provided as a dictionary for the target series or any of the covariates series, the component-specific lags are grouped into a single list to compute the corresponding feature time. @@ -1848,7 +1864,11 @@

Source code for darts.utils.data.tabularization

< # `target_series`/`past_covariates` in `Notes`: if max_lag_i > 0: times_i = times_i[max_lag_i:] - elif (not is_label_series) and (series_specified ^ lags_specified): + elif ( + show_warnings + and (not is_label_series) + and (series_specified ^ lags_specified) + ): # Warn user that series/lags input will be ignored: times_i = max_lag_i = None lags_name = "lags" if name_i == "target_series" else f"lags_{name_i}" diff --git a/_modules/darts/utils/data/training_dataset.html b/_modules/darts/utils/data/training_dataset.html index 0eadb5051c..c0fd4d16e0 100644 --- a/_modules/darts/utils/data/training_dataset.html +++ b/_modules/darts/utils/data/training_dataset.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/data/utils.html b/_modules/darts/utils/data/utils.html index 7246bb3bf2..d0bb6dd12b 100644 --- a/_modules/darts/utils/data/utils.html +++ b/_modules/darts/utils/data/utils.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/likelihood_models.html b/_modules/darts/utils/likelihood_models.html index 5a2ae57b3a..2a983e922f 100644 --- a/_modules/darts/utils/likelihood_models.html +++ b/_modules/darts/utils/likelihood_models.html @@ -34,7 +34,7 @@ - + @@ -235,7 +235,11 @@

Source code for darts.utils.likelihood_models

from darts.logging import raise_if_not # TODO: Table on README listing distribution, possible priors and wiki article -from darts.utils.utils import _check_quantiles +from darts.utils.utils import ( + _check_quantiles, + likelihood_component_names, + quantile_names, +) MIN_CAUCHY_GAMMA_SAMPLING = 1e-100 @@ -1529,11 +1533,10 @@

Source code for darts.utils.likelihood_models

[docs] def likelihood_components_names(self, input_series: TimeSeries) -> List[str]: """Each component have their own quantiles""" - return [ - f"{tgt_name}_q{quantile:.2f}" - for tgt_name in input_series.components - for quantile in self.quantiles - ]
+ return likelihood_component_names( + components=input_series.components, + parameter_names=quantile_names(self.quantiles), + )
[docs] def simplified_name(self) -> str: return "quantile"
diff --git a/_modules/darts/utils/losses.html b/_modules/darts/utils/losses.html index 481087bd6f..cdb8a1e287 100644 --- a/_modules/darts/utils/losses.html +++ b/_modules/darts/utils/losses.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/missing_values.html b/_modules/darts/utils/missing_values.html index d39217fab6..feb336b3d5 100644 --- a/_modules/darts/utils/missing_values.html +++ b/_modules/darts/utils/missing_values.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/model_selection.html b/_modules/darts/utils/model_selection.html index 1f8b703362..a1cc2e5ebc 100644 --- a/_modules/darts/utils/model_selection.html +++ b/_modules/darts/utils/model_selection.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/multioutput.html b/_modules/darts/utils/multioutput.html index b03bf5d50d..c2c34afcb7 100644 --- a/_modules/darts/utils/multioutput.html +++ b/_modules/darts/utils/multioutput.html @@ -34,7 +34,7 @@ - + @@ -274,9 +274,7 @@

Source code for darts.utils.multioutput

                 logger=logger,
             )
 
-        if sample_weight is not None and not has_fit_parameter(
-            self.estimator, "sample_weight"
-        ):
+        if sample_weight is not None and not self.supports_sample_weight:
             raise_log(
                 ValueError("Underlying estimator does not support sample weights."),
                 logger=logger,
@@ -312,7 +310,14 @@ 

Source code for darts.utils.multioutput

         if hasattr(self.estimators_[0], "feature_names_in_"):
             self.feature_names_in_ = self.estimators_[0].feature_names_in_
 
-        return self
+ return self
+ + @property + def supports_sample_weight(self) -> bool: + """ + Whether model supports sample weight for training. + """ + return has_fit_parameter(self.estimator, "sample_weight")
diff --git a/_modules/darts/utils/statistics.html b/_modules/darts/utils/statistics.html index 2a41306205..ad8594f5c4 100644 --- a/_modules/darts/utils/statistics.html +++ b/_modules/darts/utils/statistics.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/timeseries_generation.html b/_modules/darts/utils/timeseries_generation.html index 85707f9016..b2237a39d4 100644 --- a/_modules/darts/utils/timeseries_generation.html +++ b/_modules/darts/utils/timeseries_generation.html @@ -34,7 +34,7 @@ - + @@ -850,11 +850,19 @@

Source code for darts.utils.timeseries_generation

if one_hot: values_df = pd.get_dummies(values) # fill missing columns (in case not all values appear in time_index) - attribute_range = range(num_values_dict[attribute]) - for i in attribute_range: - if i not in values_df.columns: - values_df[i] = 0 - values_df = values_df[attribute_range] + attribute_range = np.arange(num_values_dict[attribute]) + is_missing = np.isin(attribute_range, values_df.columns.values, invert=True) + # if there are attribute_range columns that are + # not in values_df.columns.values + if is_missing.any(): + dict_0 = {i: False for i in attribute_range[is_missing]} + # Make a dataframe from the dictionary and concatenate it + # to the values values_df in which the existing columns + values_df = pd.concat( + [values_df, pd.DataFrame(dict_0, index=values_df.index)], axis=1 + ).sort_index(axis=1) + else: + values_df = values_df[attribute_range] if with_columns is None: with_columns = [ diff --git a/_modules/darts/utils/torch.html b/_modules/darts/utils/torch.html index 44bf0afb3e..23f5e7ca87 100644 --- a/_modules/darts/utils/torch.html +++ b/_modules/darts/utils/torch.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/ts_utils.html b/_modules/darts/utils/ts_utils.html index f42ca93789..bf191c3a3f 100644 --- a/_modules/darts/utils/ts_utils.html +++ b/_modules/darts/utils/ts_utils.html @@ -34,7 +34,7 @@ - + diff --git a/_modules/darts/utils/utils.html b/_modules/darts/utils/utils.html index 1966fd556d..31769f1b37 100644 --- a/_modules/darts/utils/utils.html +++ b/_modules/darts/utils/utils.html @@ -34,7 +34,7 @@ - + @@ -181,7 +181,7 @@

Source code for darts.utils.utils

 from enum import Enum
 from functools import wraps
 from inspect import Parameter, getcallargs, signature
-from typing import Callable, Iterator, List, Optional, Tuple, TypeVar, Union
+from typing import Callable, Iterator, List, Optional, Sequence, Tuple, TypeVar, Union
 
 import numpy as np
 import pandas as pd
@@ -242,6 +242,66 @@ 

Source code for darts.utils.utils

 }
 
 
+
[docs]def likelihood_component_names( + components: Union[pd.Index, List[str]], parameter_names: List[str] +): + """Generates formatted likelihood parameter names for components and parameter names. + + The order of the returned names is: `[comp1_param_1, ... comp1_param_n, ..., comp_n_param_n]`. + + Parameters + ---------- + components + A sequence of component names to add to the beginning of the returned names. + parameter_names + A sequence of likelihood parameter names to add to the end of the returned names. + """ + return [ + f"{tgt_name}_{param_n}" + for tgt_name in components + for param_n in parameter_names + ]
+ + +
[docs]def quantile_names(q: Union[float, List[float]], component: Optional[str] = None): + """Generates formatted quantile names, optionally added to a component name. + + Parameters + ---------- + q + A float or list of floats with the quantiles to generate the names for. + component + Optionally, a component name to add to the beginning of the quantile names. + """ + # predicted quantile text format + comp = f"{component}_" if component is not None else "" + if isinstance(q, float): + return f"{comp}q{q:.2f}" + else: + return [f"{comp}q{q_i:.2f}" for q_i in q]
+ + +
[docs]def quantile_interval_names( + q_interval: Union[Tuple[float, float], Sequence[Tuple[float, float]]], + component: Optional[str] = None, +): + """Generates formatted quantile interval names, optionally added to a component name. + + Parameters + ---------- + q_interval + A tuple or multiple tuples with the (lower bound, upper bound) of the quantile intervals. + component + Optionally, a component name to add to the beginning of the quantile names. + """ + # predicted quantile text format + comp = f"{component}_" if component is not None else "" + if isinstance(q_interval, tuple): + return f"{comp}q{q_interval[0]:.2f}_q{q_interval[1]:.2f}" + else: + return [f"{comp}q{q_lo:.2f}_q{q_hi:.2f}" for q_lo, q_hi in q_interval]
+ + def _build_tqdm_iterator(iterable, verbose, **kwargs): """ Build an iterable, possibly using tqdm (either in notebook or regular mode) @@ -604,8 +664,8 @@

Source code for darts.utils.utils

 
 
 
[docs]def generate_index( - start: Optional[Union[pd.Timestamp, int]] = None, - end: Optional[Union[pd.Timestamp, int]] = None, + start: Optional[Union[pd.Timestamp, str, int]] = None, + end: Optional[Union[pd.Timestamp, str, int]] = None, length: Optional[int] = None, freq: Union[str, int, pd.DateOffset] = None, name: str = None, @@ -616,7 +676,7 @@

Source code for darts.utils.utils

     Parameters
     ----------
     start
-        The start of the returned index. If a pandas Timestamp is passed, the index will be a pandas
+        The start of the returned index. If a pandas Timestamp or a date string is passed, the index will be a pandas
         DatetimeIndex. If an integer is passed, the index will be a pandas RangeIndex index. Works only with
         either `length` or `end`.
     end
@@ -652,6 +712,9 @@ 

Source code for darts.utils.utils

         logger,
     )
 
+    start = pd.Timestamp(start) if isinstance(start, str) else start
+    end = pd.Timestamp(end) if isinstance(end, str) else end
+
     if isinstance(start, pd.Timestamp) or isinstance(end, pd.Timestamp):
         freq = "D" if freq is None else freq
         freq = pd.tseries.frequencies.to_offset(freq) if isinstance(freq, str) else freq
diff --git a/_modules/index.html b/_modules/index.html
index 6047e00f5a..02d2facb16 100644
--- a/_modules/index.html
+++ b/_modules/index.html
@@ -34,7 +34,7 @@
     
     
     
-    
+    
     
     
     
@@ -180,6 +180,7 @@ 

All modules for which code is available

  • darts.ad.anomaly_model.filtering_am
  • darts.ad.anomaly_model.forecasting_am
  • darts.ad.detectors.detectors
  • +
  • darts.ad.detectors.iqr_detector
  • darts.ad.detectors.quantile_detector
  • darts.ad.detectors.threshold_detector
  • darts.ad.scorers.difference_scorer
  • diff --git a/_modules/sklearn/multioutput.html b/_modules/sklearn/multioutput.html index bdad929416..7f57e7ef82 100644 --- a/_modules/sklearn/multioutput.html +++ b/_modules/sklearn/multioutput.html @@ -34,7 +34,7 @@ - + @@ -173,8 +173,7 @@

    Source code for sklearn.multioutput

    -"""
    -This module implements multioutput regression and classification.
    +"""Multioutput regression and classification.
     
     The estimators provided in this module are meta-estimators: they require
     a base estimator to be provided in their constructor. The meta-estimator
    diff --git a/_modules/torch/nn/modules/normalization.html b/_modules/torch/nn/modules/normalization.html
    index f3f613ec8f..f256b7baaf 100644
    --- a/_modules/torch/nn/modules/normalization.html
    +++ b/_modules/torch/nn/modules/normalization.html
    @@ -34,7 +34,7 @@
         
         
         
    -    
    +    
         
         
         
    @@ -173,7 +173,8 @@
                   

    Source code for torch.nn.modules.normalization

    -import torch
    +# mypy: allow-untyped-defs
    +import torch
     import numbers
     from torch.nn.parameter import Parameter
     from .module import Module
    @@ -182,9 +183,9 @@ 

    Source code for torch.nn.modules.normalization

    from .. import init from torch import Tensor, Size -from typing import Union, List, Tuple +from typing import Union, List, Optional, Tuple -__all__ = ['LocalResponseNorm', 'CrossMapLRN2d', 'LayerNorm', 'GroupNorm'] +__all__ = ['LocalResponseNorm', 'CrossMapLRN2d', 'LayerNorm', 'GroupNorm', 'RMSNorm'] class LocalResponseNorm(Module): r"""Applies local response normalization over an input signal. @@ -467,6 +468,88 @@

    Source code for torch.nn.modules.normalization

    'affine={affine}'.format(**self.__dict__) +class RMSNorm(Module): + r"""Applies Root Mean Square Layer Normalization over a mini-batch of inputs. + + This layer implements the operation as described in + the paper `Root Mean Square Layer Normalization <https://arxiv.org/pdf/1910.07467.pdf>`__ + + .. math:: + y = \frac{x}{\sqrt{\mathrm{RMS}[x] + \epsilon}} * \gamma + + The root mean squared norm is taken over the last ``D`` dimensions, where ``D`` + is the dimension of :attr:`normalized_shape`. For example, if :attr:`normalized_shape` + is ``(3, 5)`` (a 2-dimensional shape), the rms norm is computed over + the last 2 dimensions of the input. + + Args: + normalized_shape (int or list or torch.Size): input shape from an expected input + of size + + .. math:: + [* \times \text{normalized\_shape}[0] \times \text{normalized\_shape}[1] + \times \ldots \times \text{normalized\_shape}[-1]] + + If a single integer is used, it is treated as a singleton list, and this module will + normalize over the last dimension which is expected to be of that specific size. + eps: a value added to the denominator for numerical stability. Default: :func:`torch.finfo(x.dtype).eps` + elementwise_affine: a boolean value that when set to ``True``, this module + has learnable per-element affine parameters initialized to ones (for weights) + and zeros (for biases). Default: ``True``. + + Shape: + - Input: :math:`(N, *)` + - Output: :math:`(N, *)` (same shape as input) + + Examples:: + + >>> rms_norm = nn.RMSNorm([2, 3]) + >>> input = torch.randn(2, 2, 3) + >>> rms_norm(input) + + """ + __constants__ = ['normalized_shape', 'eps', 'elementwise_affine'] + normalized_shape: Tuple[int, ...] + eps: Optional[float] + elementwise_affine: bool + + def __init__(self, normalized_shape: _shape_t, eps: Optional[float] = None, elementwise_affine: bool = True, + device=None, dtype=None) -> None: + factory_kwargs = {'device': device, 'dtype': dtype} + super().__init__() + if isinstance(normalized_shape, numbers.Integral): + # mypy error: incompatible types in assignment + normalized_shape = (normalized_shape,) # type: ignore[assignment] + self.normalized_shape = tuple(normalized_shape) # type: ignore[arg-type] + self.eps = eps + self.elementwise_affine = elementwise_affine + if self.elementwise_affine: + self.weight = Parameter(torch.empty(self.normalized_shape, **factory_kwargs)) + else: + self.register_parameter('weight', None) + self.reset_parameters() + + def reset_parameters(self) -> None: + """ + Resets parameters based on their initialization used in __init__. + """ + if self.elementwise_affine: + init.ones_(self.weight) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + """ + Runs forward pass. + """ + return F.rms_norm(x, self.normalized_shape, self.weight, self.eps) + + def extra_repr(self) -> str: + """ + Extra information about the module. + """ + return '{normalized_shape}, eps={eps}, ' \ + 'elementwise_affine={elementwise_affine}'.format(**self.__dict__) + + # TODO: ContrastiveNorm2d # TODO: DivisiveNorm2d # TODO: SubtractiveNorm2d diff --git a/_sources/README.rst.txt b/_sources/README.rst.txt index ecbfba7763..96ceb898a2 100644 --- a/_sources/README.rst.txt +++ b/_sources/README.rst.txt @@ -335,28 +335,28 @@ on bringing more models and features. - * - `NaiveMean `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `NaiveSeasonal `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `NaiveDrift `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `NaiveMovingAverage `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - **Statistical / Classic Models**\ :raw-html-m2r:`
    `\ (\ `LocalForecastingModel `_\ ) - - @@ -365,88 +365,88 @@ on bringing more models and features. - * - `ARIMA `_ - - - 🟩 πŸŸ₯ - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ βœ… πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `VARIMA `_ - - - πŸŸ₯ 🟩 - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - πŸ”΄ βœ… + - πŸ”΄ βœ… πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `AutoARIMA `_ - - - 🟩 πŸŸ₯ - - πŸŸ₯ 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `StatsForecastAutoArima `_ (faster AutoARIMA) - `Nixtla's statsforecast `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ βœ… πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `ExponentialSmoothing `_ - - - 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `StatsforecastAutoETS `_ - `Nixtla's statsforecast `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ βœ… πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `StatsforecastAutoCES `_ - `Nixtla's statsforecast `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `BATS `_ and `TBATS `_ - `TBATS paper `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `Theta `_ and `FourTheta `_ - `Theta `_ & `4 Theta `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `StatsForecastAutoTheta `_ - `Nixtla's statsforecast `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `Prophet `_ - `Prophet repo `_ - - 🟩 πŸŸ₯ - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ βœ… πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `FFT `_ (Fast Fourier Transform) - - - 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - `KalmanForecaster `_ using the Kalman filter and N4SID for system identification - `N4SID paper `_ - - 🟩 🟩 - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 πŸŸ₯ - - πŸŸ₯ + - βœ… βœ… + - πŸ”΄ βœ… πŸ”΄ + - βœ… πŸ”΄ + - πŸ”΄ * - `Croston `_ method - - - 🟩 πŸŸ₯ - - πŸŸ₯ 🟩 πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - πŸŸ₯ + - βœ… πŸ”΄ + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - πŸ”΄ * - **Global Baseline Models**\ :raw-html-m2r:`
    `\ (\ `GlobalForecastingModel `_\ ) - - @@ -455,22 +455,22 @@ on bringing more models and features. - * - `GlobalNaiveAggregate `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - 🟩 + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - βœ… * - `GlobalNaiveDrift `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - 🟩 + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - βœ… * - `GlobalNaiveSeasonal `_ - - - 🟩 🟩 - - πŸŸ₯ πŸŸ₯ πŸŸ₯ - - πŸŸ₯ πŸŸ₯ - - 🟩 + - βœ… βœ… + - πŸ”΄ πŸ”΄ πŸ”΄ + - πŸ”΄ πŸ”΄ + - βœ… * - **Regression Models**\ :raw-html-m2r:`
    `\ (\ `GlobalForecastingModel `_\ ) - - @@ -479,40 +479,40 @@ on bringing more models and features. - * - `RegressionModel `_\ : generic wrapper around any sklearn regression model - - - 🟩 🟩 - - 🟩 🟩 🟩 - - πŸŸ₯ πŸŸ₯ - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - πŸ”΄ πŸ”΄ + - βœ… * - `LinearRegressionModel `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `RandomForest `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - πŸŸ₯ πŸŸ₯ - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - πŸ”΄ πŸ”΄ + - βœ… * - `LightGBMModel `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `XGBModel `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `CatBoostModel `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - **PyTorch (Lightning)-based Models**\ :raw-html-m2r:`
    `\ (\ `GlobalForecastingModel `_\ ) - - @@ -521,70 +521,70 @@ on bringing more models and features. - * - `RNNModel `_ (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version - `DeepAR paper `_ - - 🟩 🟩 - - πŸŸ₯ 🟩 πŸŸ₯ - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - πŸ”΄ βœ… πŸ”΄ + - βœ… βœ… + - βœ… * - `BlockRNNModel `_ (incl. LSTM and GRU) - - - 🟩 🟩 - - 🟩 πŸŸ₯ πŸŸ₯ - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… πŸ”΄ πŸ”΄ + - βœ… βœ… + - βœ… * - `NBEATSModel `_ - `N-BEATS paper `_ - - 🟩 🟩 - - 🟩 πŸŸ₯ πŸŸ₯ - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… πŸ”΄ πŸ”΄ + - βœ… βœ… + - βœ… * - `NHiTSModel `_ - `N-HiTS paper `_ - - 🟩 🟩 - - 🟩 πŸŸ₯ πŸŸ₯ - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… πŸ”΄ πŸ”΄ + - βœ… βœ… + - βœ… * - `TCNModel `_ - `TCN paper `_\ , `DeepTCN paper `_\ , `blog post `_ - - 🟩 🟩 - - 🟩 πŸŸ₯ πŸŸ₯ - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… πŸ”΄ πŸ”΄ + - βœ… βœ… + - βœ… * - `TransformerModel `_ - - - 🟩 🟩 - - 🟩 πŸŸ₯ πŸŸ₯ - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… πŸ”΄ πŸ”΄ + - βœ… βœ… + - βœ… * - `TFTModel `_ (Temporal Fusion Transformer) - `TFT paper `_\ , `PyTorch Forecasting `_ - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `DLinearModel `_ - `DLinear paper `_ - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `NLinearModel `_ - `NLinear paper `_ - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `TiDEModel `_ - `TiDE paper `_ - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `TSMixerModel `_ - `TSMixer paper `_\ , `PyTorch Implementation `_ - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - **Ensemble Models**\ :raw-html-m2r:`
    `\ (\ `GlobalForecastingModel `_\ ): Model support is dependent on ensembled forecasting models and the ensemble model itself - - @@ -593,16 +593,16 @@ on bringing more models and features. - * - `NaiveEnsembleModel `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… * - `RegressionEnsembleModel `_ - - - 🟩 🟩 - - 🟩 🟩 🟩 - - 🟩 🟩 - - 🟩 + - βœ… βœ… + - βœ… βœ… βœ… + - βœ… βœ… + - βœ… Community & Contact diff --git a/_sources/examples/14-transfer-learning.ipynb.txt b/_sources/examples/14-transfer-learning.ipynb.txt index 1e43ae785b..c3e02ff35d 100644 --- a/_sources/examples/14-transfer-learning.ipynb.txt +++ b/_sources/examples/14-transfer-learning.ipynb.txt @@ -1201,7 +1201,7 @@ " },\n", ")\n", "\n", - "nbeats_model_air.fit(air_train, num_loader_workers=4, epochs=NUM_EPOCHS)\n", + "nbeats_model_air.fit(air_train, dataloader_kwargs={\"num_workers\":4}, epochs=NUM_EPOCHS)\n", "\n", "# get predictions\n", "nb_preds = nbeats_model_air.predict(series=air_train, n=HORIZON)\n", @@ -1433,7 +1433,7 @@ "# Train\n", "nbeats_model_m4.fit(\n", " m4_train,\n", - " num_loader_workers=4,\n", + " dataloader_kwargs={\"num_workers\":4},\n", " epochs=NUM_EPOCHS,\n", " max_samples_per_ts=MAX_SAMPLES_PER_TS,\n", ")" diff --git a/_sources/examples/17-hyperparameter-optimization.ipynb.txt b/_sources/examples/17-hyperparameter-optimization.ipynb.txt index b6613a7a11..86b79a8624 100644 --- a/_sources/examples/17-hyperparameter-optimization.ipynb.txt +++ b/_sources/examples/17-hyperparameter-optimization.ipynb.txt @@ -496,7 +496,7 @@ " series=train,\n", " val_series=model_val_set,\n", " max_samples_per_ts=MAX_SAMPLES_PER_TS,\n", - " num_loader_workers=num_workers,\n", + " dataloader_kwargs={\"num_workers\": num_workers},\n", " )\n", "\n", " # reload best model over course of training\n", diff --git a/_sources/examples/21-TSMixer-examples.ipynb.txt b/_sources/examples/21-TSMixer-examples.ipynb.txt index ff23323f26..27aa3277b0 100644 --- a/_sources/examples/21-TSMixer-examples.ipynb.txt +++ b/_sources/examples/21-TSMixer-examples.ipynb.txt @@ -985,7 +985,7 @@ "Here are some ways to further improve the performance:\n", "\n", "- set `full_training=True`\n", - "- perform hyperparmaeter tuning\n", + "- perform hyperparameter tuning\n", "- add more covariates (we have only added cyclic encodings of calendar information)\n", "- ..." ] diff --git a/_sources/generated_api/darts.ad.detectors.iqr_detector.rst.txt b/_sources/generated_api/darts.ad.detectors.iqr_detector.rst.txt new file mode 100644 index 0000000000..f7e6ce2d4d --- /dev/null +++ b/_sources/generated_api/darts.ad.detectors.iqr_detector.rst.txt @@ -0,0 +1,3 @@ +.. automodule:: darts.ad.detectors.iqr_detector + :members: + :undoc-members: \ No newline at end of file diff --git a/_sources/generated_api/darts.ad.detectors.rst.txt b/_sources/generated_api/darts.ad.detectors.rst.txt index 4549357d84..94c92fe967 100644 --- a/_sources/generated_api/darts.ad.detectors.rst.txt +++ b/_sources/generated_api/darts.ad.detectors.rst.txt @@ -8,5 +8,6 @@ darts.ad.detectors.detectors + darts.ad.detectors.iqr_detector darts.ad.detectors.quantile_detector darts.ad.detectors.threshold_detector \ No newline at end of file diff --git a/_sources/release_notes/RELEASE_NOTES.rst.txt b/_sources/release_notes/RELEASE_NOTES.rst.txt index 38449ffe34..d125876d64 100644 --- a/_sources/release_notes/RELEASE_NOTES.rst.txt +++ b/_sources/release_notes/RELEASE_NOTES.rst.txt @@ -8,7 +8,7 @@ but cannot always guarantee backwards compatibility. Changes that may **break co `Unreleased `_ ---------------------------------------------------------------- -`Full Changelog `_ +`Full Changelog `_ For users of the library: ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,6 +22,82 @@ For users of the library: For developers of the library: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +`0.31.0 `_ (2024-10-13) +------------------------------------------------------------------------- + +For users of the library: +^^^^^^^^^^^^^^^^^^^^^^^^^ + +**Improved** + + +* Improvements to ``metrics``\ : + + * Added support for computing metrics on one or multiple quantiles ``q``\ , either from probabilistic or quantile forecasts. `#2530 `_ by `Dennis Bader `_. + * Added quantile interval metrics ``miw`` (Mean Interval Width, time aggregated) and ``iw`` (Interval Width, per time step / non-aggregated) which compute the width of quantile intervals ``q_intervals`` (expected to be a tuple or sequence of tuples with (lower quantile, upper quantile). `#2530 `_ by `Dennis Bader `_. + +* Improvements to ``backtest()`` and ``residuals()``\ : + + * Added support for computing backtest and residuals on one or multiple quantiles ``q`` in the ``metric_kwargs``\ , either from probabilistic or quantile forecasts. `#2530 `_ by `Dennis Bader `_. + * Added support for parameters ``enable_optimization`` and ``predict_likelihood_parameters``. `#2530 `_ by `Dennis Bader `_. + +* Improvements to ``TimeSeries``\ : + + * Added support for broadcasting TimeSeries on component and sample level for arithmetic operations. `#2476 `_ by `Joel L. `_. + * Added property ``TimeSeries.shape`` to get the shape of the time series. `#2530 `_ by `Dennis Bader `_. + +* Other improvements: + + * Added a new anomaly detector ``IQRDetector``\ , that allows to detect anomalies using the Interquartile Range algorithm. `#2441 `_ by `Igor Urbanik `_. + * Added hyperparameters ``temporal_hidden_size_past/future`` controlling the hidden layer sizes for the feature encoders in ``TiDEModel``. `#2408 `_ by `eschibli `_. + * Added hyperparameter ``activation`` to ``BlockRNNModel`` to specify the activation function in case of a multi-layer output network. `#2504 `_ by `Szymon Cogiel `_. + * Helper function ``darts.utils.utils.generate_index()`` now accepts datetime strings as ``start`` and ``end`` parameters to generate the pandas DatetimeIndex. `#2522 `_ by `Dennis Bader `_. + +* Improvements to the documentation: + + * Made README's forecasting model support table more colorblind-friendly. `#2433 `_ by `Jatin Shridhar `_. + * Updated the Ray Tune Hyperparameter Optimization example in the `user guide `_ to work with the latest ``ray`` versions (\ ``>=2.31.0``\ ). `#2459 `_ by `He Weilin `_. + * Indicate that ``multi_models=False`` induce a lags shift for each step in ``output_chunk_length`` in ``RegressionModel`` and ``LinearRegressionModel``. `#2511 `_ by `Antoine Madrona `_. + * Added reference to ``timeseries_generation.datetime_attribute_timeseries`` in ``TimeSeries.add_datetime_attribute`` (0-indexing of encoding is enforced). `#2511 `_ by `Antoine Madrona `_. + +**Fixed** + + +* Fixes to ``RegressionModel``\ : + + * Fixed a bug when performing probabilistic optimized historical forecasts (\ ``num_samples>1, retrain=False, enable_optimization=True``\ ) with regression models, where reshaping the array resulted in a wrong order of samples across components and forecasts. `#2534 `_ by `Dennis Bader `_. + * Fixed a bug when predicting with ``predict_likelihood_parameters=True``\ , ``n > 1`` and a ``RegressionModel`` with ``multi_models=False`` that uses a ``likelihood``. The prediction now works without raising an exception. `#2545 `_ by `Dennis Bader `_. + * Fixed a bug when using ``historical_forecasts()`` with a pre-trained ``RegressionModel`` that has no target lags ``lags=None`` but uses static covariates. `#2426 `_ by `Dennis Bader `_. + * Fixed a bug when using ``fit()`` with a ``RegressionModel`` that uses an underlying ``model`` which does not support ``sample_weight``. `#2445 `_ by `He Weilin `_. + * Fixed a bug when using ``save()`` and ``load()`` with a ``RegressionEnsembleModel`` that ensembles any ``TorchForecastingModel``. `#2437 `_ by `GeorgeXiaojie `_. + * Fixed a bug with ``xgboost>=2.1.0``\ , where multi output regression was not properly handled. `#2426 `_ by `Dennis Bader `_. + +* Fixes to ``TimeSeries``\ : + + * Fixed a bug when plotting a probabilistic multivariate series with ``TimeSeries.plot()``\ , where all confidence intervals (starting from 2nd component) had the same color as the median line. `#2532 `_ by `Dennis Bader `_. + * Fixed a bug when using ``TimeSeries.from_group_dataframe()`` with a ``time_col`` of type integer, where the resulting time index was wrongly converted to a DatetimeIndex. `#2512 `_ by `Alessio Pellegrini `_ + * Fixed a bug where passing an empty array to ``TimeSeries.prepend/append_values()`` raised an error. `#2522 `_ by `Alessio Pellegrini `_ + * Fixed a bug with ``TimeSeries.prepend/append_values()``\ , where the name of the (time) index was lost. `#2522 `_ by `Alessio Pellegrini `_ + +* Other fixes: + + * Fixed a bug when using ``ShapExplainer.explain()`` with some selected ``target_components`` and a regression model that natively supports multi output regression: The target components were not properly mapped. `#2428 `_ by `Dennis Bader `_. + * Fixed a bug with ``CrostonModel``\ , which actually does not support future covariates. `#2511 `_ by `Antoine Madrona `_. + * Fixed the comment of ``scorers_are_univariate`` in class ``AnomalyModel``. `#2452 `_ by `He Weilin `_. + +**Dependencies** + + +* Bumped release requirements versions for jupyterlab and dependencies: `#2515 `_ by `Dennis Bader `_. + + * Bumped ``ipython`` from 8.10.0 to 8.18.1 + * Bumped ``ipykernel`` from 5.3.4 to 6.29.5 + * Bumped ``ipywidgets`` from 7.5.1 to 8.1.5 + * Bumped ``jupyterlab`` from 4.0.11 to 4.2.5 + +For developers of the library: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `0.30.0 `_ (2024-06-19) ------------------------------------------------------------------------- @@ -39,7 +115,7 @@ For users of the library: * Added an `example notebook `_ that showcases how to use Darts for Time Series Anomaly Detection. * Added a new dataset ``TaxiNewYorkDataset`` for anomaly detection with the number of taxi passengers in New York from the years 2014 and 2015. - * ``FittableWindowScorer`` (KMeans, PyOD, and Wasserstein Scorers) now accept any of darts `"per-time" step metrics `_ as difference function ``diff_fn``. + * ``FittableWindowScorer`` (KMeans, PyOD, and Wasserstein Scorers) now accept any of darts `"per-time" step metrics `_ as difference function ``diff_fn``. * ``ForecastingAnomalyModel`` is now much faster in generating forecasts (input for the scorers) thanks to optimized historical forecasts. We also added more control over the historical forecasts generation through additional parameters in all model methods. * πŸ”΄ Breaking changes: @@ -162,8 +238,7 @@ For users of the library: * ``rho_risk()`` : * Renamed to ``qr()`` (Quantile Risk). - - * Renamed quantile parameter ``rho`` to ``q``. + * Renamed quantile parameter ``rho`` to ``q``. * Scaled metrics do not allow seasonality inference anymore with ``m=None``. * Custom metrics using decorators ``multi_ts_support`` and ``multivariate_support`` must now act on multivariate series (possibly containing missing values) instead of univariate series. @@ -503,7 +578,7 @@ For users of the library: * Improvements to ``Explainability`` module: - * πŸš€πŸš€ New forecasting model explainer: ``TFTExplainer`` for ``TFTModel``. You can now access and visualize the trained model's feature importances and self attention. `#1392 `_ by `Sebastian Cattes `_ and `Dennis Bader `_. + * πŸš€πŸš€ New forecasting model explainer: ``TFTExplainer`` for ``TFTModel``. You can now access and visualize the trained model's feature importances and self attention. `#1392 `_ by `Sebastian Cattes `_ and `Dennis Bader `_. * Added static covariates support to ``ShapeExplainer``. `#1803 `_ by `Anne de Vries `_ and `Dennis Bader `_. * Improvements to documentation `#1904 `_ by `Dennis Bader `_\ : @@ -515,7 +590,7 @@ For users of the library: * Improved static covariates column naming when using ``StaticCovariatesTransformer`` with a ``sklearn.preprocessing.OneHotEncoder``. `#1863 `_ by `Anne de Vries `_. * Added ``MSTL`` (Season-Trend decomposition using LOESS for multiple seasonalities) as a ``method`` option for ``extract_trend_and_seasonality()``. `#1879 `_ by `Alex Colpitts `_. - * Added ``RINorm`` (Reversible Instance Norm) as a new input normalization option for ``TorchForecastingModel``. So far only ``TiDEModel`` supports it with model creation parameter ``use_reversible_instance_norm``. `#1865 `_ by `Alex Colpitts `_. + * Added ``RINorm`` (Reversible Instance Norm) as a new input normalization option for ``TorchForecastingModel``. So far only ``TiDEModel`` supports it with model creation parameter ``use_reversible_instance_norm``. `#1865 `_ by `Alex Colpitts `_. * Improvements to ``TimeSeries.plot()`` : custom axes are now properly supported with parameter ``ax``. Axis is now returned for downstream tasks. `#1916 `_ by `Dennis Bader `_. **Fixed** @@ -529,7 +604,7 @@ For users of the library: * Fixed ``TimeSeries.__getitem__()`` for series with a RangeIndex with start != 0 and freq != 1. `#1868 `_ by `Dennis Bader `_. * Fixed an issue where ``DTWAlignment.plot_alignment()`` was not plotting the alignment plot of series with a RangeIndex correctly. `#1880 `_ by `Ahmet Zamanis `_ and `Dennis Bader `_. * Fixed an issue when calling ``ARIMA.predict()`` and ``num_samples > 1`` (probabilistic forecasting), where the start point of the simulation was not anchored to the end of the target series. `#1893 `_ by `Dennis Bader `_. -* Fixed an issue when using ``TFTModel.predict()`` with ``full_attention=True`` where the attention mask was not applied properly. `#1392 `_ by `Dennis Bader `_. +* Fixed an issue when using ``TFTModel.predict()`` with ``full_attention=True`` where the attention mask was not applied properly. `#1392 `_ by `Dennis Bader `_. For developers of the library: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -537,8 +612,8 @@ For developers of the library: **Improvements** -* Refactored the ``ForecastingModelExplainer`` and ``ExplainabilityResult`` to simplify implementation of new explainers. `#1392 `_ by `Dennis Bader `_. -* Adapted all unit tests to run successfully on M1 devices. `#1933 `_ by `Dennis Bader `_. +* Refactored the ``ForecastingModelExplainer`` and ``ExplainabilityResult`` to simplify implementation of new explainers. `#1392 `_ by `Dennis Bader `_. +* Adapted all unit tests to run successfully on M1 devices. `#1933 `_ by `Dennis Bader `_. `0.24.0 `_ (2023-04-12) ------------------------------------------------------------------------- @@ -696,7 +771,7 @@ For users of the library: * Fixed edge case in ShapExplainer for regression models where covariates series > target series - `#1310 `_ by `Rijk van der Meulen `_ + `#1310 `_ by `Rijk van der Meulen `_ * Fixed a bug in ``TimeSeries.resample()`` `#1350 `_ by `Antoine Madrona `_. * Fixed splitting methods when split point is not in the series @@ -724,9 +799,9 @@ For users of the library: * Added support for past and future covariates to ``residuals()`` function. `#1223 `_ by `Eliane Maalouf `_. * Added support for retraining model(s) every ``n`` iteration and on custom conditions in ``historical_forecasts`` method of ``ForecastingModel``\ s. `#1139 `_ by `Francesco Bruzzesi `_. * Added support for beta-NLL in ``GaussianLikelihood``\ s, as proposed in `this paper `_. `#1162 `_ by `Julien Herzen `_. -* New LayerNorm alternatives, RMSNorm and LayerNormNoBias `#1113 `_ by `Greg DeVos `_. +* New LayerNorm alternatives, RMSNorm and LayerNormNoBias `#1113 `_ by `Greg DeVos `_. * πŸ”΄ Improvements to encoders: improve fitting behavior of encoders' transformers and solve a couple of issues. Remove support for absolute index encoding. `#1257 `_ by `Dennis Bader `_. -* Overwrite min_train_series_length for Catboost and LightGBM `#1214 `_ by `Anne de Vries `_. +* Overwrite min_train_series_length for Catboost and LightGBM `#1214 `_ by `Anne de Vries `_. * New example notebook showcasing and end-to-end example of hyperparameter optimization with Optuna `#1242 `_ by `Julien Herzen `_. * New user guide section on hyperparameter optimization with Optuna and Ray Tune `#1242 `_ by `Julien Herzen `_. * Documentation on model saving and loading. `#1210 `_ by `Amadej Kocbek `_. @@ -741,7 +816,7 @@ For users of the library: * An issue with calling ``fit_transform()`` on reconciliators. `#1165 `_ by `Julien Herzen `_. * A bug in ``GaussianLikelihood`` object causing issues with confidence intervals. `#1162 `_ by `Julien Herzen `_. * An issue which prevented plotting ``TimeSeries`` of length 1. `#1206 `_ by `Julien Herzen `_. -* Type hinting for ExponentialSmoothing model `#1185 `_ by `Rijk van der Meulen `_ +* Type hinting for ExponentialSmoothing model `#1185 `_ by `Rijk van der Meulen `_ `0.21.0 `_ (2022-08-12) ------------------------------------------------------------------------- @@ -798,7 +873,7 @@ For users of the library: by `Greg DeVos `_ * New dataset, `Uber TLC `_. `#1003 `_ by `Greg DeVos `_. * Model Improvements: Option for changing activation function for NHiTs and NBEATS. NBEATS support for dropout. NHiTs Support for AvgPooling1d. `#955 `_ by `Greg DeVos `_. -* Implemented `"GLU Variants Improve Transformer" `_ for transformer based models (transformer and TFT). `#959 `_ by `Greg DeVos `_. +* Implemented `"GLU Variants Improve Transformer" `_ for transformer based models (transformer and TFT). `#968 `_ by `Greg DeVos `_. * Added support for torch metrics during training and validation. `#996 `_ by `Greg DeVos `_. * Better handling of logging `#1010 `_ by `Dustin Brunner `_. * Better support for Python 3.10, and dropping ``prophet`` as a dependency (\ ``Prophet`` model still works if ``prophet`` package is installed separately) `#1023 `_ by `Julien Herzen `_. @@ -952,7 +1027,7 @@ For users of the library: * Fixed an issue with tensorboard and gridsearch when ``model_name`` is provided. - `#759 `_ by `@gdevos010 `_. + `#760 `_ by `@gdevos010 `_. * Fixed issues with pip-tools. `#762 `_ by `Tomas Van Pottelbergh `_. @@ -1158,7 +1233,7 @@ For users of the library: * Added user-defined seasonalities either at model creation with kwarg ``add_seasonality`` (\ ``Prophet(add_seasonality=kwargs_dict)``\ ) or pre-fit with ``model.add_seasonality(kwargs)``. For more information on how to add seasonalities, - see the `Prophet docs `_. + see the `Prophet docs `_. * Added possibility to predict and return the base model's raw output with ``model.predict_raw()``. Note that this returns a pd.DataFrame ``pred_df``\ , which will not be supported for further processing with the Darts API. But it is possible to access Prophet's methods such as @@ -1223,7 +1298,7 @@ For users of the library: **Fixed:** -* Removed `extra 1x1 convolutions `_ in TCN Model. +* Removed `extra 1x1 convolutions `_ in TCN Model. * Fixed an issue with linewidth parameter when plotting ``TimeSeries``. * Fixed a column name issue in datetime attribute time series. @@ -1284,47 +1359,32 @@ For users of the library: **Added:** -* - πŸ”΄ Improvement of the covariates support. Before, some models were accepting a ``covariates`` (or ``exog``\ ) +* πŸ”΄ Improvement of the covariates support. Before, some models were accepting a ``covariates`` (or ``exog``\ ) argument, but it wasn't always clear whether this represented "past-observed" or "future-known" covariates. We have made this clearer. Now all covariate-aware models support ``past_covariates`` and/or ``future_covariates`` argument in their ``fit()`` and ``predict()`` methods, which makes it clear what series is used as a past or future covariate. We recommend `this article `_ for more information and examples. - -* - πŸ”΄ Significant improvement of ``RegressionModel`` (incl. ``LinearRegressionModel`` and ``RandomForest``\ ). +* πŸ”΄ Significant improvement of ``RegressionModel`` (incl. ``LinearRegressionModel`` and ``RandomForest``\ ). These models now support training on multiple (possibly multivariate) time series. They also support both ``past_covariates`` and ``future_covariates``. It makes it easier than ever to fit arbitrary regression models (e.g. from scikit-learn) on multiple series, to predict the future of a target series based on arbitrary lags of the target and the past/future covariates. The signature of these models changed: It's not using "\ ``exog``\ " keyword arguments, but ``past_covariates`` and ``future_covariates`` instead. - -* - Dynamic Time Warping. There is a brand new ``darts.dataprocessing.dtw`` submodule that +* Dynamic Time Warping. There is a brand new ``darts.dataprocessing.dtw`` submodule that implements Dynamic Time Warping between two ``TimeSeries``. It's also coming with a new ``dtw`` metric in ``darts.metrics``. We recommend going over the `new DTW example notebook `_ for a good overview of the new functionalities - -* - Conda forge installation support (fully supported with Python 3.7 only for now). You can now +* Conda forge installation support (fully supported with Python 3.7 only for now). You can now ``conda install u8darts-all``. - -* - ``TimeSeries.from_csv()`` allows to obtain a ``TimeSeries`` from a CSV file directly. - -* - Optional cyclic encoding of the datetime attributes future covariates; for instance it's now possible to call +* ``TimeSeries.from_csv()`` allows to obtain a ``TimeSeries`` from a CSV file directly. +* Optional cyclic encoding of the datetime attributes future covariates; for instance it's now possible to call ``my_series.add_datetime_attribute('weekday', cyclic=True)``\ , which will add two columns containing a sin/cos encoding of the weekday. - -* - Default seasonality inference in ``ExponentialSmoothing``. If left to ``None``\ , the ``seasonal_periods`` is inferred +* Default seasonality inference in ``ExponentialSmoothing``. If left to ``None``\ , the ``seasonal_periods`` is inferred from the ``freq`` of the provided series. - -* - Various documentation improvements. +* Various documentation improvements. **Fixed:** @@ -1427,10 +1487,11 @@ For users of the library: * The way to instantiate Dataset classes; datasets should now be used like this - .. code-block:: - from darts.datasets import AirPassengers - ts: TimeSeries = AirPassengers().load() +.. code-block:: + + from darts.datasets import AirPassengers + ts: TimeSeries = AirPassengers().load() `0.8.0 `_ (2021-05-21) ----------------------------------------------------------------------- @@ -1709,7 +1770,7 @@ For users of the library: * Better indexing on TimeSeries (support for column/component indexing) `#150 `_ * New ``FourTheta`` forecasting model `#123 `_\ , `#156 `_ -* ``map()`` method for TimeSeries `#121 `_\ , `#166 `_ +* ``map()`` method for TimeSeries `#163 `_\ , `#166 `_ * Further improved the backtesting functions `#111 `_\ : * Added support for multivariate TimeSeries and models @@ -1767,8 +1828,8 @@ For users of the library: * Solved issue of TorchForecastingModel.predict(n) throwing an error at n=1. `#108 `_ * Fixed MASE metrics `#129 `_ -* [BUG] ForecastingModel.backtest: Can bypass sanity checks `#188 `_ -* ForecastingModel.backtest() fails if forecast_horizon isn't provided `#186 `_ +* BUG ForecastingModel.backtest: Can bypass sanity checks `#189 `_ +* ``ForecastingModel.backtest()`` fails if ``forecast_horizon`` isn't provided `#186 `_ For developers of the library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/_sources/userguide/hyperparameter_optimization.rst.txt b/_sources/userguide/hyperparameter_optimization.rst.txt index 9fb5175579..0dc648eb32 100644 --- a/_sources/userguide/hyperparameter_optimization.rst.txt +++ b/_sources/userguide/hyperparameter_optimization.rst.txt @@ -149,40 +149,53 @@ Hyperparameter optimization with Ray Tune `Ray Tune `_ is another option for hyperparameter optimization with automatic pruning. -Here is an example of how to use Ray Tune to with the ``NBEATSModel`` model using the `Asynchronous Hyperband scheduler `_. +Here is an example of how to use Ray Tune to with the ``NBEATSModel`` model using the `Asynchronous Hyperband scheduler `_. The example was tested with ray version ``ray==2.32.0``. .. code-block:: python + import numpy as np import pandas as pd + import pytorch_lightning as pl from pytorch_lightning.callbacks import EarlyStopping from ray import tune + from ray.train import RunConfig from ray.tune import CLIReporter - from ray.tune.integration.pytorch_lightning import TuneReportCallback + from ray.tune.integration.pytorch_lightning import TuneReportCheckpointCallback from ray.tune.schedulers import ASHAScheduler - from torchmetrics import MeanAbsoluteError, MeanAbsolutePercentageError, MetricCollection + from ray.tune.tuner import Tuner + from torchmetrics import ( + MeanAbsoluteError, + MeanAbsolutePercentageError, + MetricCollection, + ) from darts.dataprocessing.transformers import Scaler from darts.datasets import AirPassengersDataset from darts.models import NBEATSModel + def train_model(model_args, callbacks, train, val): - torch_metrics = MetricCollection([MeanAbsolutePercentageError(), MeanAbsoluteError()]) + torch_metrics = MetricCollection( + [MeanAbsolutePercentageError(), MeanAbsoluteError()] + ) # Create the model using model_args from Ray Tune model = NBEATSModel( input_chunk_length=24, output_chunk_length=12, - n_epochs=500, + n_epochs=100, torch_metrics=torch_metrics, pl_trainer_kwargs={"callbacks": callbacks, "enable_progress_bar": False}, - **model_args) + **model_args, + ) model.fit( series=train, val_series=val, ) + # Read data: - series = AirPassengersDataset().load() + series = AirPassengersDataset().load().astype(np.float32) # Create training and validation sets: train, val = series.split_after(pd.Timestamp(year=1957, month=12, day=1)) @@ -198,10 +211,16 @@ Here is an example of how to use Ray Tune to with the ``NBEATSModel`` model usin monitor="val_MeanAbsolutePercentageError", patience=5, min_delta=0.05, - mode='min', + mode="min", ) + # set up ray tune callback + class TuneReportCallback(TuneReportCheckpointCallback, pl.Callback): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + tune_callback = TuneReportCallback( { "loss": "val_loss", @@ -210,6 +229,17 @@ Here is an example of how to use Ray Tune to with the ``NBEATSModel`` model usin on="validation_end", ) + # Define the trainable function that will be tuned by Ray Tune + train_fn_with_parameters = tune.with_parameters( + train_model, + callbacks=[tune_callback, my_stopper], + train=train, + val=val, + ) + + # Set the resources to be used for each trial (disable GPU, if you don't have one) + resources_per_trial = {"cpu": 8, "gpu": 1} + # define the hyperparameter space config = { "batch_size": tune.choice([16, 32, 64, 128]), @@ -218,38 +248,33 @@ Here is an example of how to use Ray Tune to with the ``NBEATSModel`` model usin "dropout": tune.uniform(0, 0.2), } - reporter = CLIReporter( - parameter_columns=list(config.keys()), - metric_columns=["loss", "MAPE", "training_iteration"], - ) - - resources_per_trial = {"cpu": 8, "gpu": 1} - # the number of combinations to try num_samples = 10 + # Configure the ASHA scheduler scheduler = ASHAScheduler(max_t=1000, grace_period=3, reduction_factor=2) - train_fn_with_parameters = tune.with_parameters( - train_model, callbacks=[my_stopper, tune_callback], train=train, val=val, + # Configure the CLI reporter to display the progress + reporter = CLIReporter( + parameter_columns=list(config.keys()), + metric_columns=["loss", "MAPE", "training_iteration"], ) - # optimize hyperparameters by minimizing the MAPE on the validation set - analysis = tune.run( - train_fn_with_parameters, - resources_per_trial=resources_per_trial, - # Using a metric instead of loss allows for - # comparison between different likelihood or loss functions. - metric="MAPE", # any value in TuneReportCallback. - mode="min", - config=config, - num_samples=num_samples, - scheduler=scheduler, - progress_reporter=reporter, - name="tune_darts", + # Create the Tuner object and run the hyperparameter search + tuner = Tuner( + trainable=tune.with_resources( + train_fn_with_parameters, resources=resources_per_trial + ), + param_space=config, + tune_config=tune.TuneConfig( + metric="MAPE", mode="min", num_samples=num_samples, scheduler=scheduler + ), + run_config=RunConfig(name="tune_darts", progress_reporter=reporter), ) + results = tuner.fit() - print("Best hyperparameters found were: ", analysis.best_config) + # Print the best hyperparameters found + print("Best hyperparameters found were: ", results.get_best_result().config) Hyperparameter optimization using ``gridsearch()`` ------------------------------------------------------ diff --git a/_sources/userguide/torch_forecasting_models.rst.txt b/_sources/userguide/torch_forecasting_models.rst.txt index 46f0ccf58d..00c1601585 100644 --- a/_sources/userguide/torch_forecasting_models.rst.txt +++ b/_sources/userguide/torch_forecasting_models.rst.txt @@ -662,9 +662,8 @@ of backward passes per epoch and has the potential to better parallelize computa Tune ``num_loader_workers`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -All deep learning models in Darts have a parameter ``num_loader_workers`` in their ``fit()`` and ``predict()`` functions, which -configures the ``num_workers`` parameter in the PyTorch ``DataLoaders``. By default -it is set to 0, which means that the main process will also take care of loading the data. Setting ``num_workers > 0`` will use additional workers to load the data. This typically incurs some overhead (notably increasing memory consumption), but in some cases it can also substantially improve performance. +All deep learning models in Darts have a parameter ``dataloader_kwargs`` in their ``fit()`` and ``predict()`` functions, which configures the PyTorch DataLoaders. The ``num_workers`` parameter for PyTorch DataLoaders can be set using the ``num_workers`` key in the ``dataloader_kwargs`` dictionary. +Setting ``num_workers > 0`` will use additional workers to load the data. This typically incurs some overhead (notably increasing memory consumption), but in some cases it can also substantially improve performance. The ideal value depends on many factors such as the batch size, whether you are using a GPU, the number of CPU cores available, and whether loading the data involved I/O operations (if the series are stored on disk). diff --git a/examples.html b/examples.html index 9cb8b55d9a..6d6dda97c5 100644 --- a/examples.html +++ b/examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/01-multi-time-series-and-covariates.html b/examples/01-multi-time-series-and-covariates.html index a7eaaec084..82350d5ac6 100644 --- a/examples/01-multi-time-series-and-covariates.html +++ b/examples/01-multi-time-series-and-covariates.html @@ -35,7 +35,7 @@ - + diff --git a/examples/02-data-processing.html b/examples/02-data-processing.html index fc2de2a28d..5a8b4f83b4 100644 --- a/examples/02-data-processing.html +++ b/examples/02-data-processing.html @@ -35,7 +35,7 @@ - + diff --git a/examples/03-FFT-examples.html b/examples/03-FFT-examples.html index ab31f2cca4..79bbea5381 100644 --- a/examples/03-FFT-examples.html +++ b/examples/03-FFT-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/04-RNN-examples.html b/examples/04-RNN-examples.html index d735f63e37..61d5f0a177 100644 --- a/examples/04-RNN-examples.html +++ b/examples/04-RNN-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/05-TCN-examples.html b/examples/05-TCN-examples.html index 86d54385d3..f4777351b5 100644 --- a/examples/05-TCN-examples.html +++ b/examples/05-TCN-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/06-Transformer-examples.html b/examples/06-Transformer-examples.html index 5300f5e6fc..a298c835ff 100644 --- a/examples/06-Transformer-examples.html +++ b/examples/06-Transformer-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/07-NBEATS-examples.html b/examples/07-NBEATS-examples.html index 337543a45d..ef2634b44c 100644 --- a/examples/07-NBEATS-examples.html +++ b/examples/07-NBEATS-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/08-DeepAR-examples.html b/examples/08-DeepAR-examples.html index 163a17ef6b..d48bc42537 100644 --- a/examples/08-DeepAR-examples.html +++ b/examples/08-DeepAR-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/09-DeepTCN-examples.html b/examples/09-DeepTCN-examples.html index 90a596429d..70cf4d01f2 100644 --- a/examples/09-DeepTCN-examples.html +++ b/examples/09-DeepTCN-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/10-Kalman-filter-examples.html b/examples/10-Kalman-filter-examples.html index 51ad49b0e4..bf04087b34 100644 --- a/examples/10-Kalman-filter-examples.html +++ b/examples/10-Kalman-filter-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/11-GP-filter-examples.html b/examples/11-GP-filter-examples.html index 96b4e5c719..1929c027db 100644 --- a/examples/11-GP-filter-examples.html +++ b/examples/11-GP-filter-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/12-Dynamic-Time-Warping-example.html b/examples/12-Dynamic-Time-Warping-example.html index 1e9177f3d0..1944be38c3 100644 --- a/examples/12-Dynamic-Time-Warping-example.html +++ b/examples/12-Dynamic-Time-Warping-example.html @@ -35,7 +35,7 @@ - + diff --git a/examples/13-TFT-examples.html b/examples/13-TFT-examples.html index 3730d01096..39624e03e5 100644 --- a/examples/13-TFT-examples.html +++ b/examples/13-TFT-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/14-transfer-learning.html b/examples/14-transfer-learning.html index ac1c8d3e51..71143a74d5 100644 --- a/examples/14-transfer-learning.html +++ b/examples/14-transfer-learning.html @@ -35,7 +35,7 @@ - + @@ -1621,7 +1621,7 @@

    Part 2.2: Using deep learning}, ) -nbeats_model_air.fit(air_train, num_loader_workers=4, epochs=NUM_EPOCHS) +nbeats_model_air.fit(air_train, dataloader_kwargs={"num_workers":4}, epochs=NUM_EPOCHS) # get predictions nb_preds = nbeats_model_air.predict(series=air_train, n=HORIZON) @@ -1825,7 +1825,7 @@

    Part 3: Training an N-BEATS model on # Train nbeats_model_m4.fit( m4_train, - num_loader_workers=4, + dataloader_kwargs={"num_workers":4}, epochs=NUM_EPOCHS, max_samples_per_ts=MAX_SAMPLES_PER_TS, ) diff --git a/examples/14-transfer-learning.ipynb b/examples/14-transfer-learning.ipynb index 66e61061ee..be2930026c 100644 --- a/examples/14-transfer-learning.ipynb +++ b/examples/14-transfer-learning.ipynb @@ -33,7 +33,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6d6edf1", + "id": "f5371be5", "metadata": {}, "outputs": [], "source": [ @@ -1202,7 +1202,7 @@ " },\n", ")\n", "\n", - "nbeats_model_air.fit(air_train, num_loader_workers=4, epochs=NUM_EPOCHS)\n", + "nbeats_model_air.fit(air_train, dataloader_kwargs={\"num_workers\":4}, epochs=NUM_EPOCHS)\n", "\n", "# get predictions\n", "nb_preds = nbeats_model_air.predict(series=air_train, n=HORIZON)\n", @@ -1434,7 +1434,7 @@ "# Train\n", "nbeats_model_m4.fit(\n", " m4_train,\n", - " num_loader_workers=4,\n", + " dataloader_kwargs={\"num_workers\":4},\n", " epochs=NUM_EPOCHS,\n", " max_samples_per_ts=MAX_SAMPLES_PER_TS,\n", ")" diff --git a/examples/15-static-covariates.html b/examples/15-static-covariates.html index ebd9004fd2..56787a251b 100644 --- a/examples/15-static-covariates.html +++ b/examples/15-static-covariates.html @@ -35,7 +35,7 @@ - + diff --git a/examples/16-hierarchical-reconciliation.html b/examples/16-hierarchical-reconciliation.html index c8a77c852e..3193de6131 100644 --- a/examples/16-hierarchical-reconciliation.html +++ b/examples/16-hierarchical-reconciliation.html @@ -35,7 +35,7 @@ - + diff --git a/examples/17-hyperparameter-optimization.html b/examples/17-hyperparameter-optimization.html index 1ebde62856..ff08b292f2 100644 --- a/examples/17-hyperparameter-optimization.html +++ b/examples/17-hyperparameter-optimization.html @@ -35,7 +35,7 @@ - + @@ -1006,7 +1006,7 @@

    Build a Simple TCN Modelseries=train, val_series=model_val_set, max_samples_per_ts=MAX_SAMPLES_PER_TS, - num_loader_workers=num_workers, + dataloader_kwargs={"num_workers": num_workers}, ) # reload best model over course of training diff --git a/examples/17-hyperparameter-optimization.ipynb b/examples/17-hyperparameter-optimization.ipynb index b6613a7a11..86b79a8624 100644 --- a/examples/17-hyperparameter-optimization.ipynb +++ b/examples/17-hyperparameter-optimization.ipynb @@ -496,7 +496,7 @@ " series=train,\n", " val_series=model_val_set,\n", " max_samples_per_ts=MAX_SAMPLES_PER_TS,\n", - " num_loader_workers=num_workers,\n", + " dataloader_kwargs={\"num_workers\": num_workers},\n", " )\n", "\n", " # reload best model over course of training\n", diff --git a/examples/18-TiDE-examples.html b/examples/18-TiDE-examples.html index 73c77a8a42..8cdccdf7b1 100644 --- a/examples/18-TiDE-examples.html +++ b/examples/18-TiDE-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/19-EnsembleModel-examples.html b/examples/19-EnsembleModel-examples.html index 901879038b..0cae0bbe65 100644 --- a/examples/19-EnsembleModel-examples.html +++ b/examples/19-EnsembleModel-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/20-RegressionModel-examples.html b/examples/20-RegressionModel-examples.html index 5269ea07d2..21d207b51f 100644 --- a/examples/20-RegressionModel-examples.html +++ b/examples/20-RegressionModel-examples.html @@ -35,7 +35,7 @@ - + diff --git a/examples/21-TSMixer-examples.html b/examples/21-TSMixer-examples.html index 115801cfa3..c74fa89c0c 100644 --- a/examples/21-TSMixer-examples.html +++ b/examples/21-TSMixer-examples.html @@ -35,7 +35,7 @@ - + @@ -1445,7 +1445,7 @@

    Results
  • set full_training=True

  • -
  • perform hyperparmaeter tuning

  • +
  • perform hyperparameter tuning

  • add more covariates (we have only added cyclic encodings of calendar information)

  • …

  • diff --git a/examples/21-TSMixer-examples.ipynb b/examples/21-TSMixer-examples.ipynb index ff23323f26..27aa3277b0 100644 --- a/examples/21-TSMixer-examples.ipynb +++ b/examples/21-TSMixer-examples.ipynb @@ -985,7 +985,7 @@ "Here are some ways to further improve the performance:\n", "\n", "- set `full_training=True`\n", - "- perform hyperparmaeter tuning\n", + "- perform hyperparameter tuning\n", "- add more covariates (we have only added cyclic encodings of calendar information)\n", "- ..." ] diff --git a/examples/22-anomaly-detection-examples.html b/examples/22-anomaly-detection-examples.html index 79f1f7ce08..9568e0ffd7 100644 --- a/examples/22-anomaly-detection-examples.html +++ b/examples/22-anomaly-detection-examples.html @@ -35,7 +35,7 @@ - + @@ -748,7 +748,7 @@

    Anomaly Detection Darts ModuleAnomaly Models: offer a convenient way to produce anomaly scores from any of Darts’ global forecasting models or filtering models by comparing the models’ predictions with actual observations. Each Anomaly Model takes one forecasting/filtering model and one or multiple scorers. The model produces some predictions, which are fed together with the actual series to the scorer(s). It will return anomaly scores for each scorer.

    The figure below illustrates the different input/output for each tool:

    -

    324ed31758d94770bf09008e7fdc486d

    +

    8a0afabf1483430f96df9fd42d4a2c85

    The notebook is devided into two sections:

    • How to use ForecastingAnomalyModel to find anomalies in the number of taxi passengers in New York.

    • @@ -956,7 +956,7 @@

      Use a Forecasting Anomaly Modelwindow parameter is an integer value indicating the window size used by the scorer to transform the series into an anomaly score. A scorer will slice the given series into subsequences of size W and returns a value indicating how anomalous these subset of W values are.

      The window_agg can be used to transform the window-wise scores into point-wise scores by aggregating all anomaly scores from each window that the point was included in.

      The following figure illustrates the mechanism of a Forecasting Anomaly model:

      -

      9ee404c93a084b2ba46c6316fb53278a

      +

      9669815d9ee446c2b6ac3af0308eb018

      Using the main functions: fit(), score(), eval_metric() and show_anomalies()ΒΆ

      @@ -1396,7 +1396,7 @@

      A zoom on each anomalies: visualize the resultsKMeansScorerΒΆ

      Let’s have a closer look at the scorer’s window parameter on the example of the KmeansScorer. We’ll use two toy datasets to demonstrate how the scorers perform with different window sizes. In first example we set window=1 on a multivariate time series, and in the second we set window=2 on a univariate time series.

      The figure below illustrates the Scorer’s windowing process:

      -

      142153b59456427a977309ddb1115a5a

      +

      2c729d28566849159f7647b1d33c85bb

      Multivariate case with window=1ΒΆ

      diff --git a/generated_api/darts.ad.aggregators.aggregators.html b/generated_api/darts.ad.aggregators.aggregators.html index d62f7e6459..1e51e97ab1 100644 --- a/generated_api/darts.ad.aggregators.aggregators.html +++ b/generated_api/darts.ad.aggregators.aggregators.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
      - +

      next

      -

      Quantile Detector

      +

      Interquartile Range (IQR) Detector

      diff --git a/generated_api/darts.ad.detectors.html b/generated_api/darts.ad.detectors.html index a2e5101d53..93b98bc427 100644 --- a/generated_api/darts.ad.detectors.html +++ b/generated_api/darts.ad.detectors.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
        +
      • + + Interquartile Range (IQR) Detector + +
      • Quantile Detector @@ -870,6 +875,7 @@

        Anomaly Detectors diff --git a/generated_api/darts.ad.detectors.iqr_detector.html b/generated_api/darts.ad.detectors.iqr_detector.html new file mode 100644 index 0000000000..5f950649e0 --- /dev/null +++ b/generated_api/darts.ad.detectors.iqr_detector.html @@ -0,0 +1,1062 @@ + + + + + + + + + Interquartile Range (IQR) Detector — darts documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        + + + +
        +
        + + + + +
        + + +
        + + + +
        + +
        + +
        + + +
        + + + + + + +
        + +
        + +
        +

        Interquartile Range (IQR) DetectorΒΆ

        +

        Flags anomalies that are beyond the IQR (between the third and the first quartile) +of historical data by some factor of it’s difference (typically 1.5). +This is similar to a threshold-based detector, but the thresholds are +computed as distances from the IQR of historical data when the detector is fitted.

        +
        +
        +class darts.ad.detectors.iqr_detector.IQRDetector(scale=1.5)[source]ΒΆ
        +

        Bases: QuantileDetector

        +

        IQR Detector

        +

        Flags values that lie outside of the interquartile range (IQR) +by more than a certain factor of IQR’s value as anomalies. +The factor is passed in the scale parameter.

        +

        If a single value is provided for scale, +this same value will be used across all components of the series.

        +

        If a sequences of values is given for the scale parameter, +it’s length must match the dimensionality of the series passed.

        +
        +
        Parameters
        +

        scale (Union[Sequence[float], float]) – (Sequence of) scale(s) used to indicate what distance from the IQR constitutes an anomaly. +Defaults to 1.5. Must be non-negative. If a sequence, must match the dimensionality of the series +this detector is applied to.

        +
        +
        +

        Attributes

        + ++++ + + + + + + + + +

        high_threshold

        low_threshold

        +

        Methods

        + ++++ + + + + + + + + + + + + + + +

        detect(series[,Β name])

        Detect anomalies on given time series.

        eval_metric(anomalies,Β pred_scores[,Β ...])

        Score the results against true anomalies.

        fit(series)

        Trains the detector on the given time series.

        fit_detect(series)

        Trains the detector and detects anomalies on the same series.

        +
        +
        +detect(series, name='series')ΒΆ
        +

        Detect anomalies on given time series.

        +
        +
        Parameters
        +
          +
        • series (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) series on which to detect anomalies.

        • +
        • name (str) – The name of series.

        • +
        +
        +
        Returns
        +

        binary prediction (1 if considered as an anomaly, 0 if not)

        +
        +
        Return type
        +

        Union[TimeSeries, Sequence[TimeSeries]]

        +
        +
        +
        + +
        +
        +eval_metric(anomalies, pred_scores, window=1, metric='recall')ΒΆ
        +

        Score the results against true anomalies.

        +
        +
        Parameters
        +
          +
        • anomalies (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) ground truth binary anomaly series (1 if it is an anomaly and 0 if not).

        • +
        • pred_scores (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) of estimated anomaly score series indicating how anomalous each window of size w is.

        • +
        • window (int) – Integer value indicating the number of past samples each point represents in the pred_scores.

        • +
        • metric (Literal[β€˜recall’, β€˜precision’, β€˜f1’, β€˜accuracy’]) – The name of the metric function to use. Must be one of β€œrecall”, β€œprecision”, β€œf1”, and β€œaccuracy”. +Default: β€œrecall”.

        • +
        +
        +
        Returns
        +

        Metric results for each anomaly score

        +
        +
        Return type
        +

        Union[float, Sequence[float], Sequence[Sequence[float]]]

        +
        +
        +
        + +
        +
        +fit(series)ΒΆ
        +

        Trains the detector on the given time series.

        +
        +
        Parameters
        +

        series (Union[TimeSeries, Sequence[TimeSeries]]) – Time (sequence of) series to be used to train the detector.

        +
        +
        Returns
        +

        Fitted Detector.

        +
        +
        Return type
        +

        self

        +
        +
        +
        + +
        +
        +fit_detect(series)ΒΆ
        +

        Trains the detector and detects anomalies on the same series.

        +
        +
        Parameters
        +

        series (Union[TimeSeries, Sequence[TimeSeries]]) – Time series to be used for training and be detected for anomalies.

        +
        +
        Returns
        +

        Binary prediciton (1 if considered as an anomaly, 0 if not)

        +
        +
        Return type
        +

        Union[TimeSeries, Sequence[TimeSeries]]

        +
        +
        +
        + +
        +
        +property high_thresholdΒΆ
        +
        + +
        +
        +property low_thresholdΒΆ
        +
        + +
        + +
        + + +
        + + + + + +
        + + +
        +
        + + +
        +
        + + + + + +
        +
        + + \ No newline at end of file diff --git a/generated_api/darts.ad.detectors.quantile_detector.html b/generated_api/darts.ad.detectors.quantile_detector.html index 492b55abdc..9329a3ab59 100644 --- a/generated_api/darts.ad.detectors.quantile_detector.html +++ b/generated_api/darts.ad.detectors.quantile_detector.html @@ -35,12 +35,12 @@ - + - + @@ -224,6 +224,11 @@
          +
        • + + Interquartile Range (IQR) Detector + +
        • Quantile Detector @@ -1020,11 +1025,11 @@

          Quantile Detector +

          previous

          -

          <no title>

          +

          Interquartile Range (IQR) Detector

          diff --git a/generated_api/darts.ad.detectors.threshold_detector.html b/generated_api/darts.ad.detectors.threshold_detector.html index 0fe82e631d..9ca5c12207 100644 --- a/generated_api/darts.ad.detectors.threshold_detector.html +++ b/generated_api/darts.ad.detectors.threshold_detector.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
            +
          • + + Interquartile Range (IQR) Detector + +
          • Quantile Detector diff --git a/generated_api/darts.ad.html b/generated_api/darts.ad.html index 352d6be1ab..018706f99e 100644 --- a/generated_api/darts.ad.html +++ b/generated_api/darts.ad.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
              +
            • + + Interquartile Range (IQR) Detector + +
            • Quantile Detector diff --git a/generated_api/darts.ad.scorers.difference_scorer.html b/generated_api/darts.ad.scorers.difference_scorer.html index 9996eb4893..01b772b049 100644 --- a/generated_api/darts.ad.scorers.difference_scorer.html +++ b/generated_api/darts.ad.scorers.difference_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                +
              • + + Interquartile Range (IQR) Detector + +
              • Quantile Detector diff --git a/generated_api/darts.ad.scorers.html b/generated_api/darts.ad.scorers.html index 34a7e9cd0b..fb9ec34390 100644 --- a/generated_api/darts.ad.scorers.html +++ b/generated_api/darts.ad.scorers.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                  +
                • + + Interquartile Range (IQR) Detector + +
                • Quantile Detector diff --git a/generated_api/darts.ad.scorers.kmeans_scorer.html b/generated_api/darts.ad.scorers.kmeans_scorer.html index 2d7f557d96..8a27686daa 100644 --- a/generated_api/darts.ad.scorers.kmeans_scorer.html +++ b/generated_api/darts.ad.scorers.kmeans_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                    +
                  • + + Interquartile Range (IQR) Detector + +
                  • Quantile Detector diff --git a/generated_api/darts.ad.scorers.nll_cauchy_scorer.html b/generated_api/darts.ad.scorers.nll_cauchy_scorer.html index 5f21a3892c..ddda8cb428 100644 --- a/generated_api/darts.ad.scorers.nll_cauchy_scorer.html +++ b/generated_api/darts.ad.scorers.nll_cauchy_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                      +
                    • + + Interquartile Range (IQR) Detector + +
                    • Quantile Detector diff --git a/generated_api/darts.ad.scorers.nll_exponential_scorer.html b/generated_api/darts.ad.scorers.nll_exponential_scorer.html index 6a3be7fb6a..6b9d59279c 100644 --- a/generated_api/darts.ad.scorers.nll_exponential_scorer.html +++ b/generated_api/darts.ad.scorers.nll_exponential_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                        +
                      • + + Interquartile Range (IQR) Detector + +
                      • Quantile Detector diff --git a/generated_api/darts.ad.scorers.nll_gamma_scorer.html b/generated_api/darts.ad.scorers.nll_gamma_scorer.html index c9ca8f71de..ae04008c3b 100644 --- a/generated_api/darts.ad.scorers.nll_gamma_scorer.html +++ b/generated_api/darts.ad.scorers.nll_gamma_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                          +
                        • + + Interquartile Range (IQR) Detector + +
                        • Quantile Detector diff --git a/generated_api/darts.ad.scorers.nll_gaussian_scorer.html b/generated_api/darts.ad.scorers.nll_gaussian_scorer.html index 09e5bb0894..7b8d99b2b8 100644 --- a/generated_api/darts.ad.scorers.nll_gaussian_scorer.html +++ b/generated_api/darts.ad.scorers.nll_gaussian_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                            +
                          • + + Interquartile Range (IQR) Detector + +
                          • Quantile Detector diff --git a/generated_api/darts.ad.scorers.nll_laplace_scorer.html b/generated_api/darts.ad.scorers.nll_laplace_scorer.html index 339434cd25..8547e2ed85 100644 --- a/generated_api/darts.ad.scorers.nll_laplace_scorer.html +++ b/generated_api/darts.ad.scorers.nll_laplace_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                              +
                            • + + Interquartile Range (IQR) Detector + +
                            • Quantile Detector diff --git a/generated_api/darts.ad.scorers.nll_poisson_scorer.html b/generated_api/darts.ad.scorers.nll_poisson_scorer.html index 8eac99286b..db8a133167 100644 --- a/generated_api/darts.ad.scorers.nll_poisson_scorer.html +++ b/generated_api/darts.ad.scorers.nll_poisson_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                +
                              • + + Interquartile Range (IQR) Detector + +
                              • Quantile Detector diff --git a/generated_api/darts.ad.scorers.norm_scorer.html b/generated_api/darts.ad.scorers.norm_scorer.html index 41385eba64..02ed46795d 100644 --- a/generated_api/darts.ad.scorers.norm_scorer.html +++ b/generated_api/darts.ad.scorers.norm_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                  +
                                • + + Interquartile Range (IQR) Detector + +
                                • Quantile Detector diff --git a/generated_api/darts.ad.scorers.pyod_scorer.html b/generated_api/darts.ad.scorers.pyod_scorer.html index 33450104c8..68396ee10b 100644 --- a/generated_api/darts.ad.scorers.pyod_scorer.html +++ b/generated_api/darts.ad.scorers.pyod_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                    +
                                  • + + Interquartile Range (IQR) Detector + +
                                  • Quantile Detector diff --git a/generated_api/darts.ad.scorers.scorers.html b/generated_api/darts.ad.scorers.scorers.html index 3cf7f007c6..eef42f3a64 100644 --- a/generated_api/darts.ad.scorers.scorers.html +++ b/generated_api/darts.ad.scorers.scorers.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                      +
                                    • + + Interquartile Range (IQR) Detector + +
                                    • Quantile Detector diff --git a/generated_api/darts.ad.scorers.wasserstein_scorer.html b/generated_api/darts.ad.scorers.wasserstein_scorer.html index 7f44f778e8..2353704657 100644 --- a/generated_api/darts.ad.scorers.wasserstein_scorer.html +++ b/generated_api/darts.ad.scorers.wasserstein_scorer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                        +
                                      • + + Interquartile Range (IQR) Detector + +
                                      • Quantile Detector diff --git a/generated_api/darts.ad.utils.html b/generated_api/darts.ad.utils.html index 924adfe170..984960259b 100644 --- a/generated_api/darts.ad.utils.html +++ b/generated_api/darts.ad.utils.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                          +
                                        • + + Interquartile Range (IQR) Detector + +
                                        • Quantile Detector diff --git a/generated_api/darts.dataprocessing.dtw.cost_matrix.html b/generated_api/darts.dataprocessing.dtw.cost_matrix.html index 48481dd768..388c125225 100644 --- a/generated_api/darts.dataprocessing.dtw.cost_matrix.html +++ b/generated_api/darts.dataprocessing.dtw.cost_matrix.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                            +
                                          • + + Interquartile Range (IQR) Detector + +
                                          • Quantile Detector diff --git a/generated_api/darts.dataprocessing.dtw.dtw.html b/generated_api/darts.dataprocessing.dtw.dtw.html index 82b583a973..a860b643dd 100644 --- a/generated_api/darts.dataprocessing.dtw.dtw.html +++ b/generated_api/darts.dataprocessing.dtw.dtw.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                              +
                                            • + + Interquartile Range (IQR) Detector + +
                                            • Quantile Detector diff --git a/generated_api/darts.dataprocessing.dtw.html b/generated_api/darts.dataprocessing.dtw.html index 747241cbe3..cb14ae74c2 100644 --- a/generated_api/darts.dataprocessing.dtw.html +++ b/generated_api/darts.dataprocessing.dtw.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                +
                                              • + + Interquartile Range (IQR) Detector + +
                                              • Quantile Detector diff --git a/generated_api/darts.dataprocessing.dtw.window.html b/generated_api/darts.dataprocessing.dtw.window.html index b6c79f446a..d3c94a3b76 100644 --- a/generated_api/darts.dataprocessing.dtw.window.html +++ b/generated_api/darts.dataprocessing.dtw.window.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                  +
                                                • + + Interquartile Range (IQR) Detector + +
                                                • Quantile Detector diff --git a/generated_api/darts.dataprocessing.encoders.encoder_base.html b/generated_api/darts.dataprocessing.encoders.encoder_base.html index 4ebb1816ba..46baebe980 100644 --- a/generated_api/darts.dataprocessing.encoders.encoder_base.html +++ b/generated_api/darts.dataprocessing.encoders.encoder_base.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                    +
                                                  • + + Interquartile Range (IQR) Detector + +
                                                  • Quantile Detector diff --git a/generated_api/darts.dataprocessing.encoders.encoders.html b/generated_api/darts.dataprocessing.encoders.encoders.html index 52551889f3..3bdef3dc4b 100644 --- a/generated_api/darts.dataprocessing.encoders.encoders.html +++ b/generated_api/darts.dataprocessing.encoders.encoders.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                      +
                                                    • + + Interquartile Range (IQR) Detector + +
                                                    • Quantile Detector diff --git a/generated_api/darts.dataprocessing.encoders.html b/generated_api/darts.dataprocessing.encoders.html index a358edf6d6..a309d982b0 100644 --- a/generated_api/darts.dataprocessing.encoders.html +++ b/generated_api/darts.dataprocessing.encoders.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                        +
                                                      • + + Interquartile Range (IQR) Detector + +
                                                      • Quantile Detector diff --git a/generated_api/darts.dataprocessing.html b/generated_api/darts.dataprocessing.html index b0b0473884..2bd19d656c 100644 --- a/generated_api/darts.dataprocessing.html +++ b/generated_api/darts.dataprocessing.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                          +
                                                        • + + Interquartile Range (IQR) Detector + +
                                                        • Quantile Detector diff --git a/generated_api/darts.dataprocessing.pipeline.html b/generated_api/darts.dataprocessing.pipeline.html index 5fea401c16..b67d3ea641 100644 --- a/generated_api/darts.dataprocessing.pipeline.html +++ b/generated_api/darts.dataprocessing.pipeline.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                            +
                                                          • + + Interquartile Range (IQR) Detector + +
                                                          • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.base_data_transformer.html b/generated_api/darts.dataprocessing.transformers.base_data_transformer.html index f56fc752ec..0966b6f768 100644 --- a/generated_api/darts.dataprocessing.transformers.base_data_transformer.html +++ b/generated_api/darts.dataprocessing.transformers.base_data_transformer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                              +
                                                            • + + Interquartile Range (IQR) Detector + +
                                                            • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.boxcox.html b/generated_api/darts.dataprocessing.transformers.boxcox.html index b7a234e86f..f053292175 100644 --- a/generated_api/darts.dataprocessing.transformers.boxcox.html +++ b/generated_api/darts.dataprocessing.transformers.boxcox.html @@ -35,7 +35,7 @@ - + @@ -226,6 +226,11 @@
                                                                +
                                                              • + + Interquartile Range (IQR) Detector + +
                                                              • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.diff.html b/generated_api/darts.dataprocessing.transformers.diff.html index f276a6afc1..95a63ad51f 100644 --- a/generated_api/darts.dataprocessing.transformers.diff.html +++ b/generated_api/darts.dataprocessing.transformers.diff.html @@ -35,7 +35,7 @@ - + @@ -226,6 +226,11 @@
                                                                  +
                                                                • + + Interquartile Range (IQR) Detector + +
                                                                • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.fittable_data_transformer.html b/generated_api/darts.dataprocessing.transformers.fittable_data_transformer.html index 46987f5c99..a9a0ca6c46 100644 --- a/generated_api/darts.dataprocessing.transformers.fittable_data_transformer.html +++ b/generated_api/darts.dataprocessing.transformers.fittable_data_transformer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                    +
                                                                  • + + Interquartile Range (IQR) Detector + +
                                                                  • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.html b/generated_api/darts.dataprocessing.transformers.html index d1eb0193e9..a862afdffd 100644 --- a/generated_api/darts.dataprocessing.transformers.html +++ b/generated_api/darts.dataprocessing.transformers.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                      +
                                                                    • + + Interquartile Range (IQR) Detector + +
                                                                    • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.invertible_data_transformer.html b/generated_api/darts.dataprocessing.transformers.invertible_data_transformer.html index 82179c4497..ed89521388 100644 --- a/generated_api/darts.dataprocessing.transformers.invertible_data_transformer.html +++ b/generated_api/darts.dataprocessing.transformers.invertible_data_transformer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                        +
                                                                      • + + Interquartile Range (IQR) Detector + +
                                                                      • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.mappers.html b/generated_api/darts.dataprocessing.transformers.mappers.html index 65acaedf5c..3ddbfdbb66 100644 --- a/generated_api/darts.dataprocessing.transformers.mappers.html +++ b/generated_api/darts.dataprocessing.transformers.mappers.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                          +
                                                                        • + + Interquartile Range (IQR) Detector + +
                                                                        • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.midas.html b/generated_api/darts.dataprocessing.transformers.midas.html index 38ff479e57..1cd7a81929 100644 --- a/generated_api/darts.dataprocessing.transformers.midas.html +++ b/generated_api/darts.dataprocessing.transformers.midas.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                            +
                                                                          • + + Interquartile Range (IQR) Detector + +
                                                                          • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.missing_values_filler.html b/generated_api/darts.dataprocessing.transformers.missing_values_filler.html index 179a849243..1875bd48b6 100644 --- a/generated_api/darts.dataprocessing.transformers.missing_values_filler.html +++ b/generated_api/darts.dataprocessing.transformers.missing_values_filler.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                              +
                                                                            • + + Interquartile Range (IQR) Detector + +
                                                                            • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.reconciliation.html b/generated_api/darts.dataprocessing.transformers.reconciliation.html index 1551dc00ef..e25f0138d0 100644 --- a/generated_api/darts.dataprocessing.transformers.reconciliation.html +++ b/generated_api/darts.dataprocessing.transformers.reconciliation.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                +
                                                                              • + + Interquartile Range (IQR) Detector + +
                                                                              • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.scaler.html b/generated_api/darts.dataprocessing.transformers.scaler.html index a3380c4e1d..90d715d76b 100644 --- a/generated_api/darts.dataprocessing.transformers.scaler.html +++ b/generated_api/darts.dataprocessing.transformers.scaler.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                  +
                                                                                • + + Interquartile Range (IQR) Detector + +
                                                                                • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.static_covariates_transformer.html b/generated_api/darts.dataprocessing.transformers.static_covariates_transformer.html index 7892105ab5..ceba6bebf7 100644 --- a/generated_api/darts.dataprocessing.transformers.static_covariates_transformer.html +++ b/generated_api/darts.dataprocessing.transformers.static_covariates_transformer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                    +
                                                                                  • + + Interquartile Range (IQR) Detector + +
                                                                                  • Quantile Detector diff --git a/generated_api/darts.dataprocessing.transformers.window_transformer.html b/generated_api/darts.dataprocessing.transformers.window_transformer.html index a10ba03bbd..d08487bab2 100644 --- a/generated_api/darts.dataprocessing.transformers.window_transformer.html +++ b/generated_api/darts.dataprocessing.transformers.window_transformer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                      +
                                                                                    • + + Interquartile Range (IQR) Detector + +
                                                                                    • Quantile Detector diff --git a/generated_api/darts.datasets.dataset_loaders.html b/generated_api/darts.datasets.dataset_loaders.html index ec980d843b..990aa016f3 100644 --- a/generated_api/darts.datasets.dataset_loaders.html +++ b/generated_api/darts.datasets.dataset_loaders.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                        +
                                                                                      • + + Interquartile Range (IQR) Detector + +
                                                                                      • Quantile Detector diff --git a/generated_api/darts.datasets.html b/generated_api/darts.datasets.html index 24ecba4569..b4d802d303 100644 --- a/generated_api/darts.datasets.html +++ b/generated_api/darts.datasets.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                          +
                                                                                        • + + Interquartile Range (IQR) Detector + +
                                                                                        • Quantile Detector diff --git a/generated_api/darts.explainability.explainability.html b/generated_api/darts.explainability.explainability.html index 407725888b..464b055af3 100644 --- a/generated_api/darts.explainability.explainability.html +++ b/generated_api/darts.explainability.explainability.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                            +
                                                                                          • + + Interquartile Range (IQR) Detector + +
                                                                                          • Quantile Detector diff --git a/generated_api/darts.explainability.explainability_result.html b/generated_api/darts.explainability.explainability_result.html index e49f2803bb..d181eae3d1 100644 --- a/generated_api/darts.explainability.explainability_result.html +++ b/generated_api/darts.explainability.explainability_result.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                              +
                                                                                            • + + Interquartile Range (IQR) Detector + +
                                                                                            • Quantile Detector diff --git a/generated_api/darts.explainability.html b/generated_api/darts.explainability.html index 8cb1e0e45a..f894a4bea1 100644 --- a/generated_api/darts.explainability.html +++ b/generated_api/darts.explainability.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                +
                                                                                              • + + Interquartile Range (IQR) Detector + +
                                                                                              • Quantile Detector diff --git a/generated_api/darts.explainability.shap_explainer.html b/generated_api/darts.explainability.shap_explainer.html index a17d8c6063..9736f91ec4 100644 --- a/generated_api/darts.explainability.shap_explainer.html +++ b/generated_api/darts.explainability.shap_explainer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                  +
                                                                                                • + + Interquartile Range (IQR) Detector + +
                                                                                                • Quantile Detector diff --git a/generated_api/darts.explainability.tft_explainer.html b/generated_api/darts.explainability.tft_explainer.html index 57e8a9d1b4..c56b04f78b 100644 --- a/generated_api/darts.explainability.tft_explainer.html +++ b/generated_api/darts.explainability.tft_explainer.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                    +
                                                                                                  • + + Interquartile Range (IQR) Detector + +
                                                                                                  • Quantile Detector diff --git a/generated_api/darts.explainability.utils.html b/generated_api/darts.explainability.utils.html index bb2d1b04d5..27c07480a6 100644 --- a/generated_api/darts.explainability.utils.html +++ b/generated_api/darts.explainability.utils.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                      +
                                                                                                    • + + Interquartile Range (IQR) Detector + +
                                                                                                    • Quantile Detector diff --git a/generated_api/darts.html b/generated_api/darts.html index 69116e9b79..02647f2f1a 100644 --- a/generated_api/darts.html +++ b/generated_api/darts.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                        +
                                                                                                      • + + Interquartile Range (IQR) Detector + +
                                                                                                      • Quantile Detector diff --git a/generated_api/darts.metrics.html b/generated_api/darts.metrics.html index 7fb14714ed..ddcaafe1be 100644 --- a/generated_api/darts.metrics.html +++ b/generated_api/darts.metrics.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                          +
                                                                                                        • + + Interquartile Range (IQR) Detector + +
                                                                                                        • Quantile Detector @@ -857,8 +862,11 @@

                                                                                                          MetricsΒΆ

                                                                                                          -
                                                                                                          -
                                                                                                          For deterministic forecasts (point predictions with num_samples == 1):
                                                                                                          @@ -1751,7 +1762,7 @@

                                                                                                          Regression ensemble model
                                                                                                          -residuals(series, past_covariates=None, future_covariates=None, historical_forecasts=None, num_samples=1, train_length=None, start=None, start_format='value', forecast_horizon=1, stride=1, retrain=True, last_points_only=True, metric=<function err>, verbose=False, show_warnings=True, metric_kwargs=None, fit_kwargs=None, predict_kwargs=None, values_only=False, sample_weight=None)ΒΆ
                                                                                                          +residuals(series, past_covariates=None, future_covariates=None, historical_forecasts=None, num_samples=1, train_length=None, start=None, start_format='value', forecast_horizon=1, stride=1, retrain=True, last_points_only=True, metric=<function err>, verbose=False, show_warnings=True, predict_likelihood_parameters=False, enable_optimization=True, metric_kwargs=None, fit_kwargs=None, predict_kwargs=None, values_only=False, sample_weight=None)ΒΆ

                                                                                                          Compute the residuals produced by this model on a (or sequence of) TimeSeries.

                                                                                                          This function computes the difference (or one of Darts’ β€œper time step” metrics) between the actual observations from series and the fitted values obtained by training the model on series (or using a @@ -1849,6 +1860,11 @@

                                                                                                          Regression ensemble modelbool) – Whether to print progress.

                                                                                                        • show_warnings (bool) – Whether to show warnings related to parameters start, and train_length.

                                                                                                        • +
                                                                                                        • predict_likelihood_parameters (bool) – If set to True, the model predict the parameters of its Likelihood parameters instead of the target. Only +supported for probabilistic models with likelihood=”quantile”, num_samples = 1 and +n<=output_chunk_length. Default: False.

                                                                                                        • +
                                                                                                        • enable_optimization (bool) – Whether to use the optimized version of historical_forecasts when supported and available. +Default: True.

                                                                                                        • metric_kwargs (Optional[Dict[str, Any]]) – Additional arguments passed to metric(), such as β€˜n_jobs’ for parallelization, β€˜m’ for scaled metrics, etc. Will pass arguments only if they are present in the corresponding metric signature. Ignores reduction arguments β€œseries_reduction”, β€œcomponent_reduction”, β€œtime_reduction”, and parameter @@ -1888,24 +1904,32 @@

                                                                                                          Regression ensemble model
                                                                                                          save(path=None, **pkl_kwargs)ΒΆ
                                                                                                          -

                                                                                                          Saves the model under a given path or file handle.

                                                                                                          -

                                                                                                          Example for saving and loading a RegressionModel:

                                                                                                          +

                                                                                                          Saves the ensemble model under a given path or file handle.

                                                                                                          +

                                                                                                          Additionally, two files are stored for each TorchForecastingModel under the forecasting models.

                                                                                                          +

                                                                                                          Example for saving and loading a RegressionEnsembleModel:

                                                                                                          -
                                                                                                          from darts.models import RegressionModel
                                                                                                          +
                                                                                                          from darts.models import RegressionEnsembleModel, LinearRegressionModel, TiDEModel
                                                                                                           
                                                                                                          -model = RegressionModel(lags=4)
                                                                                                          +model = RegressionEnsembleModel(
                                                                                                          +    forecasting_models = [
                                                                                                          +        LinearRegressionModel(lags=4),
                                                                                                          +        TiDEModel(input_chunk_length=4, output_chunk_length=4),
                                                                                                          +        ],
                                                                                                          +        regression_train_n_points=10,
                                                                                                          +)
                                                                                                           
                                                                                                          -model.save("my_model.pkl")
                                                                                                          -model_loaded = RegressionModel.load("my_model.pkl")
                                                                                                          +model.save("my_ensemble_model.pkl")
                                                                                                          +model_loaded = RegressionEnsembleModel.load("my_ensemble_model.pkl")
                                                                                                           
                                                                                                          Parameters
                                                                                                            -
                                                                                                          • path (Union[str, PathLike, BinaryIO, None]) – Path or file handle under which to save the model at its current state. If no path is specified, the model -is automatically saved under "{ModelClass}_{YYYY-mm-dd_HH_MM_SS}.pkl". -E.g., "RegressionModel_2020-01-01_12_00_00.pkl".

                                                                                                          • +
                                                                                                          • path (Union[str, PathLike, BinaryIO, None]) – Path or file handle under which to save the ensemble model at its current state. If no path is specified, +the ensemble model is automatically saved under "{RegressionEnsembleModel}_{YYYY-mm-dd_HH_MM_SS}.pkl". +If the i-th model of forecasting_models is a TorchForecastingModel, two files (model object and +checkpoint) are saved under "{path}.{ithModelClass}_{i}.pt" and "{path}.{ithModelClass}_{i}.ckpt".

                                                                                                          • pkl_kwargs – Keyword arguments passed to pickle.dump()

                                                                                                          diff --git a/generated_api/darts.models.forecasting.regression_model.html b/generated_api/darts.models.forecasting.regression_model.html index f4033489d7..46dd161f8e 100644 --- a/generated_api/darts.models.forecasting.regression_model.html +++ b/generated_api/darts.models.forecasting.regression_model.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                          @@ -3249,8 +3265,16 @@

                                                                                                          Time-Series Mixer (TSMixer)Returns

                                                                                                            -
                                                                                                          • missing_keys is a list of str containing the missing keys

                                                                                                          • -
                                                                                                          • unexpected_keys is a list of str containing the unexpected keys

                                                                                                          • +
                                                                                                          • +
                                                                                                            missing_keys is a list of str containing any keys that are expected

                                                                                                            by this module but missing from the provided state_dict.

                                                                                                            +
                                                                                                            +
                                                                                                            +
                                                                                                          • +
                                                                                                          • +
                                                                                                            unexpected_keys is a list of str containing the keys that are not

                                                                                                            expected by this module but present in the provided state_dict.

                                                                                                            +
                                                                                                            +
                                                                                                            +

                                                                                                          @@ -3302,7 +3326,7 @@

                                                                                                          Time-Series Mixer (TSMixer)
                                                                                                          -momentum: floatΒΆ
                                                                                                          +momentum: Optional[float]ΒΆ
                                                                                                          diff --git a/generated_api/darts.models.forecasting.varima.html b/generated_api/darts.models.forecasting.varima.html index 5f7979ea95..8ec6fcf7aa 100644 --- a/generated_api/darts.models.forecasting.varima.html +++ b/generated_api/darts.models.forecasting.varima.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@

                                                                                                          Return type
                                                                                                          diff --git a/generated_api/darts.utils.data.training_dataset.html b/generated_api/darts.utils.data.training_dataset.html index a712e350d4..a3cda64f66 100644 --- a/generated_api/darts.utils.data.training_dataset.html +++ b/generated_api/darts.utils.data.training_dataset.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                            +
                                                                                                          • + + Interquartile Range (IQR) Detector + +
                                                                                                          • Quantile Detector diff --git a/generated_api/darts.utils.data.utils.html b/generated_api/darts.utils.data.utils.html index 4b9599294e..5683c0c4a5 100644 --- a/generated_api/darts.utils.data.utils.html +++ b/generated_api/darts.utils.data.utils.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                              +
                                                                                                            • + + Interquartile Range (IQR) Detector + +
                                                                                                            • Quantile Detector diff --git a/generated_api/darts.utils.historical_forecasts.html b/generated_api/darts.utils.historical_forecasts.html index 4ab301ec0b..3930be1690 100644 --- a/generated_api/darts.utils.historical_forecasts.html +++ b/generated_api/darts.utils.historical_forecasts.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                +
                                                                                                              • + + Interquartile Range (IQR) Detector + +
                                                                                                              • Quantile Detector diff --git a/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_regression.html b/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_regression.html index da512a4ebe..1edbdb58f7 100644 --- a/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_regression.html +++ b/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_regression.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                  +
                                                                                                                • + + Interquartile Range (IQR) Detector + +
                                                                                                                • Quantile Detector diff --git a/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_torch.html b/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_torch.html index 396dd92243..b38fe0725b 100644 --- a/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_torch.html +++ b/generated_api/darts.utils.historical_forecasts.optimized_historical_forecasts_torch.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                    +
                                                                                                                  • + + Interquartile Range (IQR) Detector + +
                                                                                                                  • Quantile Detector diff --git a/generated_api/darts.utils.historical_forecasts.utils.html b/generated_api/darts.utils.historical_forecasts.utils.html index 10a2bfcbef..7d077fce51 100644 --- a/generated_api/darts.utils.historical_forecasts.utils.html +++ b/generated_api/darts.utils.historical_forecasts.utils.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                      +
                                                                                                                    • + + Interquartile Range (IQR) Detector + +
                                                                                                                    • Quantile Detector diff --git a/generated_api/darts.utils.html b/generated_api/darts.utils.html index 9babaf6c88..8063a803e4 100644 --- a/generated_api/darts.utils.html +++ b/generated_api/darts.utils.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                        +
                                                                                                                      • + + Interquartile Range (IQR) Detector + +
                                                                                                                      • Quantile Detector diff --git a/generated_api/darts.utils.likelihood_models.html b/generated_api/darts.utils.likelihood_models.html index 6bd427e942..5076b39217 100644 --- a/generated_api/darts.utils.likelihood_models.html +++ b/generated_api/darts.utils.likelihood_models.html @@ -35,7 +35,7 @@ - + @@ -226,6 +226,11 @@
                                                                                                                          +
                                                                                                                        • + + Interquartile Range (IQR) Detector + +
                                                                                                                        • Quantile Detector diff --git a/generated_api/darts.utils.losses.html b/generated_api/darts.utils.losses.html index 93072efa7a..74a7702443 100644 --- a/generated_api/darts.utils.losses.html +++ b/generated_api/darts.utils.losses.html @@ -35,7 +35,7 @@ - + @@ -226,6 +226,11 @@
                                                                                                                            +
                                                                                                                          • + + Interquartile Range (IQR) Detector + +
                                                                                                                          • Quantile Detector @@ -1500,8 +1505,16 @@

                                                                                                                            PyTorch Loss Functions
                                                                                                                            Returns

                                                                                                                              -
                                                                                                                            • missing_keys is a list of str containing the missing keys

                                                                                                                            • -
                                                                                                                            • unexpected_keys is a list of str containing the unexpected keys

                                                                                                                            • +
                                                                                                                            • +
                                                                                                                              missing_keys is a list of str containing any keys that are expected

                                                                                                                              by this module but missing from the provided state_dict.

                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                            • +
                                                                                                                            • +
                                                                                                                              unexpected_keys is a list of str containing the keys that are not

                                                                                                                              expected by this module but present in the provided state_dict.

                                                                                                                              +
                                                                                                                              +
                                                                                                                              +

                                                                                                                            @@ -2996,8 +3009,16 @@

                                                                                                                            PyTorch Loss Functions
                                                                                                                            Returns

                                                                                                                              -
                                                                                                                            • missing_keys is a list of str containing the missing keys

                                                                                                                            • -
                                                                                                                            • unexpected_keys is a list of str containing the unexpected keys

                                                                                                                            • +
                                                                                                                            • +
                                                                                                                              missing_keys is a list of str containing any keys that are expected

                                                                                                                              by this module but missing from the provided state_dict.

                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                            • +
                                                                                                                            • +
                                                                                                                              unexpected_keys is a list of str containing the keys that are not

                                                                                                                              expected by this module but present in the provided state_dict.

                                                                                                                              +
                                                                                                                              +
                                                                                                                              +

                                                                                                                            @@ -4498,8 +4519,16 @@

                                                                                                                            PyTorch Loss Functions
                                                                                                                            Returns

                                                                                                                              -
                                                                                                                            • missing_keys is a list of str containing the missing keys

                                                                                                                            • -
                                                                                                                            • unexpected_keys is a list of str containing the unexpected keys

                                                                                                                            • +
                                                                                                                            • +
                                                                                                                              missing_keys is a list of str containing any keys that are expected

                                                                                                                              by this module but missing from the provided state_dict.

                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                            • +
                                                                                                                            • +
                                                                                                                              unexpected_keys is a list of str containing the keys that are not

                                                                                                                              expected by this module but present in the provided state_dict.

                                                                                                                              +
                                                                                                                              +
                                                                                                                              +

                                                                                                                            diff --git a/generated_api/darts.utils.missing_values.html b/generated_api/darts.utils.missing_values.html index a97be927a3..9c94be0be2 100644 --- a/generated_api/darts.utils.missing_values.html +++ b/generated_api/darts.utils.missing_values.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                              +
                                                                                                                            • + + Interquartile Range (IQR) Detector + +
                                                                                                                            • Quantile Detector diff --git a/generated_api/darts.utils.model_selection.html b/generated_api/darts.utils.model_selection.html index e369d9106d..8778d7c028 100644 --- a/generated_api/darts.utils.model_selection.html +++ b/generated_api/darts.utils.model_selection.html @@ -35,7 +35,7 @@ - + @@ -224,6 +224,11 @@
                                                                                                                                +
                                                                                                                              • + + Interquartile Range (IQR) Detector + +
                                                                                                                              • Quantile Detector diff --git a/generated_api/darts.utils.multioutput.html b/generated_api/darts.utils.multioutput.html index 601d2a8281..52bca681e9 100644 --- a/generated_api/darts.utils.multioutput.html +++ b/generated_api/darts.utils.multioutput.html @@ -35,7 +35,7 @@ - + @@ -226,6 +226,11 @@ + -
                                                                                                                              • supports_static_covariates (darts.models.forecasting.arima.ARIMA property) diff --git a/index.html b/index.html index 42d42df7b2..92ed0765e2 100644 --- a/index.html +++ b/index.html @@ -35,7 +35,7 @@ - + @@ -476,31 +476,31 @@

                                                                                                                                Forecasting Models

                                                                                                                                NaiveMean

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                NaiveSeasonal

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                NaiveDrift

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                NaiveMovingAverage

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                Statistical / Classic Models
                                                                                                                                (LocalForecastingModel)

                                                                                                                                @@ -511,101 +511,101 @@

                                                                                                                                Forecasting Models

                                                                                                                                ARIMA

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                VARIMA

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                AutoARIMA

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                StatsForecastAutoArima (faster AutoARIMA)

                                                                                                                                Nixtla’s statsforecast

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                ExponentialSmoothing

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                StatsforecastAutoETS

                                                                                                                                Nixtla’s statsforecast

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                StatsforecastAutoCES

                                                                                                                                Nixtla’s statsforecast

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                BATS and TBATS

                                                                                                                                TBATS paper

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                Theta and FourTheta

                                                                                                                                Theta & 4 Theta

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                StatsForecastAutoTheta

                                                                                                                                Nixtla’s statsforecast

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                Prophet

                                                                                                                                Prophet repo

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                FFT (Fast Fourier Transform)

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                KalmanForecaster using the Kalman filter and N4SID for system identification

                                                                                                                                N4SID paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                Croston method

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄

                                                                                                                                Global Baseline Models
                                                                                                                                (GlobalForecastingModel)

                                                                                                                                @@ -616,24 +616,24 @@

                                                                                                                                Forecasting Models

                                                                                                                                GlobalNaiveAggregate

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                GlobalNaiveDrift

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                GlobalNaiveSeasonal

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                Regression Models
                                                                                                                                (GlobalForecastingModel)

                                                                                                                                @@ -644,45 +644,45 @@

                                                                                                                                Forecasting Models

                                                                                                                                RegressionModel: generic wrapper around any sklearn regression model

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                LinearRegressionModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                RandomForest

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                LightGBMModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                XGBModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                CatBoostModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                PyTorch (Lightning)-based Models
                                                                                                                                (GlobalForecastingModel)

                                                                                                                                @@ -693,80 +693,80 @@

                                                                                                                                Forecasting Models

                                                                                                                                RNNModel (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version

                                                                                                                                DeepAR paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                πŸŸ₯ 🟩 πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                πŸ”΄ βœ… πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                BlockRNNModel (incl. LSTM and GRU)

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                NBEATSModel

                                                                                                                                N-BEATS paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                NHiTSModel

                                                                                                                                N-HiTS paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                TCNModel

                                                                                                                                TCN paper, DeepTCN paper, blog post

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                TransformerModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 πŸŸ₯ πŸŸ₯

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… πŸ”΄ πŸ”΄

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                TFTModel (Temporal Fusion Transformer)

                                                                                                                                TFT paper, PyTorch Forecasting

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                DLinearModel

                                                                                                                                DLinear paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                NLinearModel

                                                                                                                                NLinear paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                TiDEModel

                                                                                                                                TiDE paper

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                TSMixerModel

                                                                                                                                TSMixer paper, PyTorch Implementation

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                Ensemble Models
                                                                                                                                (GlobalForecastingModel): Model support is dependent on ensembled forecasting models and the ensemble model itself

                                                                                                                                @@ -777,17 +777,17 @@

                                                                                                                                Forecasting Models

                                                                                                                                NaiveEnsembleModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                RegressionEnsembleModel

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩 🟩

                                                                                                                                -

                                                                                                                                🟩 🟩

                                                                                                                                -

                                                                                                                                🟩

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ… βœ…

                                                                                                                                +

                                                                                                                                βœ…

                                                                                                                                diff --git a/objects.inv b/objects.inv index 24ffbb7257..f9d9315d0b 100644 Binary files a/objects.inv and b/objects.inv differ diff --git a/py-modindex.html b/py-modindex.html index 14a363b9b2..940b32f018 100644 --- a/py-modindex.html +++ b/py-modindex.html @@ -34,7 +34,7 @@ - + @@ -252,6 +252,11 @@

                                                                                                                                Python Module Index

                                                                                                                                    darts.ad.detectors.detectors + + +     + darts.ad.detectors.iqr_detector +     diff --git a/quickstart/00-quickstart.html b/quickstart/00-quickstart.html index d5af8fa6f7..dedb4b1abb 100644 --- a/quickstart/00-quickstart.html +++ b/quickstart/00-quickstart.html @@ -35,7 +35,7 @@ - + diff --git a/release_notes/RELEASE_NOTES.html b/release_notes/RELEASE_NOTES.html index 05d877fcf1..94ff3836a3 100644 --- a/release_notes/RELEASE_NOTES.html +++ b/release_notes/RELEASE_NOTES.html @@ -35,7 +35,7 @@ - + @@ -191,7 +191,7 @@
                                                                                                                              • - 0.30.0 (2024-06-19) + 0.31.0 (2024-10-13) +
                                                                                                                              • +
                                                                                                                              • + + 0.30.0 (2024-06-19) + +
                                                                                                                              • - + 0.29.0 (2024-04-17)
                                                                                                                              • - + 0.28.0 (2024-03-05)
                                                                                                                              • - + 0.27.2 (2024-01-21)
                                                                                                                              • - + 0.27.1 (2023-12-10)
                                                                                                                              • - + 0.27.0 (2023-11-18)
                                                                                                                              • - + 0.26.0 (2023-09-16)
                                                                                                                              • - + 0.25.0 (2023-08-04)
                                                                                                                              • - + 0.24.0 (2023-04-12)
                                                                                                                              • - + 0.23.1 (2023-01-12)
                                                                                                                              • - + 0.23.0 (2022-12-23)
                                                                                                                              • - + 0.22.0 (2022-10-04)
                                                                                                                              • - + 0.21.0 (2022-08-12)
                                                                                                                              • - + 0.20.0 (2022-06-22)
                                                                                                                              • - + 0.19.0 (2022-04-13)
                                                                                                                              • - + 0.18.0 (2022-03-22)
                                                                                                                              • - + 0.17.1 (2022-02-17)
                                                                                                                              • - + 0.17.0 (2022-02-15)
                                                                                                                              • - + 0.16.1 (2022-01-24)
                                                                                                                              • - + 0.16.0 (2022-01-13)
                                                                                                                              • - + 0.15.0 (2021-12-24)
                                                                                                                              • - + 0.14.0 (2021-11-28)
                                                                                                                              • - + 0.13.1 (2021-11-08)
                                                                                                                              • - + 0.13.0 (2021-11-07)
                                                                                                                              • - + 0.12.0 (2021-09-25)
                                                                                                                              • - + 0.11.0 (2021-09-04)
                                                                                                                              • - + 0.10.1 (2021-08-19)
                                                                                                                              • - + 0.10.0 (2021-08-13)
                                                                                                                              • - + 0.9.1 (2021-07-17)
                                                                                                                              • - + 0.9.0 (2021-07-09)
                                                                                                                              • - + 0.8.1 (2021-05-22)
                                                                                                                              • - + 0.8.0 (2021-05-21)
                                                                                                                              • - + 0.7.0 (2021-04-14)
                                                                                                                              • - + 0.6.0 (2021-02-02)
                                                                                                                              • - + 0.5.0 (2020-11-09)
                                                                                                                              • - + 0.4.0 (2020-10-28)
                                                                                                                              • - + 0.3.0 (2020-10-05)