autogluon.timeseries 1.2.1b20250224__py3-none-any.whl → 1.4.1b20251215__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of autogluon.timeseries might be problematic. Click here for more details.
- autogluon/timeseries/configs/__init__.py +3 -2
- autogluon/timeseries/configs/hyperparameter_presets.py +62 -0
- autogluon/timeseries/configs/predictor_presets.py +106 -0
- autogluon/timeseries/dataset/ts_dataframe.py +256 -141
- autogluon/timeseries/learner.py +86 -52
- autogluon/timeseries/metrics/__init__.py +42 -8
- autogluon/timeseries/metrics/abstract.py +89 -19
- autogluon/timeseries/metrics/point.py +142 -53
- autogluon/timeseries/metrics/quantile.py +46 -21
- autogluon/timeseries/metrics/utils.py +4 -4
- autogluon/timeseries/models/__init__.py +8 -2
- autogluon/timeseries/models/abstract/__init__.py +2 -2
- autogluon/timeseries/models/abstract/abstract_timeseries_model.py +361 -592
- autogluon/timeseries/models/abstract/model_trial.py +2 -1
- autogluon/timeseries/models/abstract/tunable.py +189 -0
- autogluon/timeseries/models/autogluon_tabular/__init__.py +2 -0
- autogluon/timeseries/models/autogluon_tabular/mlforecast.py +282 -194
- autogluon/timeseries/models/autogluon_tabular/per_step.py +513 -0
- autogluon/timeseries/models/autogluon_tabular/transforms.py +25 -18
- autogluon/timeseries/models/chronos/__init__.py +2 -1
- autogluon/timeseries/models/chronos/chronos2.py +361 -0
- autogluon/timeseries/models/chronos/model.py +219 -138
- autogluon/timeseries/models/chronos/{pipeline/utils.py → utils.py} +81 -50
- autogluon/timeseries/models/ensemble/__init__.py +37 -2
- autogluon/timeseries/models/ensemble/abstract.py +107 -0
- autogluon/timeseries/models/ensemble/array_based/__init__.py +3 -0
- autogluon/timeseries/models/ensemble/array_based/abstract.py +240 -0
- autogluon/timeseries/models/ensemble/array_based/models.py +185 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/__init__.py +12 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/abstract.py +88 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/linear_stacker.py +186 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/per_quantile_tabular.py +94 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/tabular.py +107 -0
- autogluon/timeseries/models/ensemble/ensemble_selection.py +167 -0
- autogluon/timeseries/models/ensemble/per_item_greedy.py +172 -0
- autogluon/timeseries/models/ensemble/weighted/__init__.py +8 -0
- autogluon/timeseries/models/ensemble/weighted/abstract.py +45 -0
- autogluon/timeseries/models/ensemble/weighted/basic.py +91 -0
- autogluon/timeseries/models/ensemble/weighted/greedy.py +62 -0
- autogluon/timeseries/models/gluonts/__init__.py +1 -1
- autogluon/timeseries/models/gluonts/{abstract_gluonts.py → abstract.py} +148 -208
- autogluon/timeseries/models/gluonts/dataset.py +109 -0
- autogluon/timeseries/models/gluonts/{torch/models.py → models.py} +38 -22
- autogluon/timeseries/models/local/__init__.py +0 -7
- autogluon/timeseries/models/local/abstract_local_model.py +71 -74
- autogluon/timeseries/models/local/naive.py +13 -9
- autogluon/timeseries/models/local/npts.py +9 -2
- autogluon/timeseries/models/local/statsforecast.py +52 -36
- autogluon/timeseries/models/multi_window/multi_window_model.py +65 -45
- autogluon/timeseries/models/registry.py +64 -0
- autogluon/timeseries/models/toto/__init__.py +3 -0
- autogluon/timeseries/models/toto/_internal/__init__.py +9 -0
- autogluon/timeseries/models/toto/_internal/backbone/__init__.py +3 -0
- autogluon/timeseries/models/toto/_internal/backbone/attention.py +196 -0
- autogluon/timeseries/models/toto/_internal/backbone/backbone.py +262 -0
- autogluon/timeseries/models/toto/_internal/backbone/distribution.py +70 -0
- autogluon/timeseries/models/toto/_internal/backbone/kvcache.py +136 -0
- autogluon/timeseries/models/toto/_internal/backbone/rope.py +89 -0
- autogluon/timeseries/models/toto/_internal/backbone/rotary_embedding_torch.py +342 -0
- autogluon/timeseries/models/toto/_internal/backbone/scaler.py +305 -0
- autogluon/timeseries/models/toto/_internal/backbone/transformer.py +333 -0
- autogluon/timeseries/models/toto/_internal/dataset.py +165 -0
- autogluon/timeseries/models/toto/_internal/forecaster.py +423 -0
- autogluon/timeseries/models/toto/dataloader.py +108 -0
- autogluon/timeseries/models/toto/hf_pretrained_model.py +200 -0
- autogluon/timeseries/models/toto/model.py +249 -0
- autogluon/timeseries/predictor.py +685 -297
- autogluon/timeseries/regressor.py +94 -44
- autogluon/timeseries/splitter.py +8 -32
- autogluon/timeseries/trainer/__init__.py +3 -0
- autogluon/timeseries/trainer/ensemble_composer.py +444 -0
- autogluon/timeseries/trainer/model_set_builder.py +256 -0
- autogluon/timeseries/trainer/prediction_cache.py +149 -0
- autogluon/timeseries/{trainer.py → trainer/trainer.py} +387 -390
- autogluon/timeseries/trainer/utils.py +17 -0
- autogluon/timeseries/transforms/__init__.py +2 -13
- autogluon/timeseries/transforms/covariate_scaler.py +34 -40
- autogluon/timeseries/transforms/target_scaler.py +37 -20
- autogluon/timeseries/utils/constants.py +10 -0
- autogluon/timeseries/utils/datetime/lags.py +3 -5
- autogluon/timeseries/utils/datetime/seasonality.py +1 -3
- autogluon/timeseries/utils/datetime/time_features.py +2 -2
- autogluon/timeseries/utils/features.py +70 -47
- autogluon/timeseries/utils/forecast.py +19 -14
- autogluon/timeseries/utils/timer.py +173 -0
- autogluon/timeseries/utils/warning_filters.py +4 -2
- autogluon/timeseries/version.py +1 -1
- autogluon.timeseries-1.4.1b20251215-py3.11-nspkg.pth +1 -0
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/METADATA +49 -36
- autogluon_timeseries-1.4.1b20251215.dist-info/RECORD +103 -0
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/WHEEL +1 -1
- autogluon/timeseries/configs/presets_configs.py +0 -79
- autogluon/timeseries/evaluator.py +0 -6
- autogluon/timeseries/models/chronos/pipeline/__init__.py +0 -11
- autogluon/timeseries/models/chronos/pipeline/base.py +0 -160
- autogluon/timeseries/models/chronos/pipeline/chronos.py +0 -585
- autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py +0 -518
- autogluon/timeseries/models/ensemble/abstract_timeseries_ensemble.py +0 -78
- autogluon/timeseries/models/ensemble/greedy_ensemble.py +0 -170
- autogluon/timeseries/models/gluonts/torch/__init__.py +0 -0
- autogluon/timeseries/models/presets.py +0 -360
- autogluon.timeseries-1.2.1b20250224-py3.9-nspkg.pth +0 -1
- autogluon.timeseries-1.2.1b20250224.dist-info/RECORD +0 -68
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info/licenses}/LICENSE +0 -0
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info/licenses}/NOTICE +0 -0
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/namespace_packages.txt +0 -0
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/top_level.txt +0 -0
- {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/zip-safe +0 -0
|
@@ -17,13 +17,14 @@ class NaiveModel(AbstractLocalModel):
|
|
|
17
17
|
|
|
18
18
|
Other Parameters
|
|
19
19
|
----------------
|
|
20
|
-
n_jobs : int or float, default =
|
|
20
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
21
21
|
Number of CPU cores used to fit the models in parallel.
|
|
22
22
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
23
23
|
When set to a positive integer, that many cores are used.
|
|
24
24
|
When set to -1, all CPU cores are used.
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
|
+
ag_priority = 100
|
|
27
28
|
allowed_local_model_args = ["seasonal_period"]
|
|
28
29
|
|
|
29
30
|
def _predict_with_local_model(
|
|
@@ -59,18 +60,19 @@ class SeasonalNaiveModel(AbstractLocalModel):
|
|
|
59
60
|
specified manually by providing an integer > 1.
|
|
60
61
|
If seasonal_period (inferred or provided) is equal to 1, will fall back to Naive forecast.
|
|
61
62
|
Seasonality will also be disabled, if the length of the time series is < seasonal_period.
|
|
62
|
-
n_jobs : int or float, default =
|
|
63
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
63
64
|
Number of CPU cores used to fit the models in parallel.
|
|
64
65
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
65
66
|
When set to a positive integer, that many cores are used.
|
|
66
67
|
When set to -1, all CPU cores are used.
|
|
67
68
|
"""
|
|
68
69
|
|
|
70
|
+
ag_priority = 100
|
|
69
71
|
allowed_local_model_args = ["seasonal_period"]
|
|
70
72
|
|
|
71
73
|
def _predict_with_local_model(
|
|
72
74
|
self,
|
|
73
|
-
time_series:
|
|
75
|
+
time_series: pd.Series,
|
|
74
76
|
local_model_args: dict,
|
|
75
77
|
) -> pd.DataFrame:
|
|
76
78
|
return seasonal_naive_forecast(
|
|
@@ -85,20 +87,21 @@ class SeasonalNaiveModel(AbstractLocalModel):
|
|
|
85
87
|
|
|
86
88
|
|
|
87
89
|
class AverageModel(AbstractLocalModel):
|
|
88
|
-
"""Baseline model that sets the forecast equal to the
|
|
90
|
+
"""Baseline model that sets the forecast equal to the historical average or quantile.
|
|
89
91
|
|
|
90
92
|
Other Parameters
|
|
91
93
|
----------------
|
|
92
|
-
n_jobs : int or float, default =
|
|
94
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
93
95
|
Number of CPU cores used to fit the models in parallel.
|
|
94
96
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
95
97
|
When set to a positive integer, that many cores are used.
|
|
96
98
|
When set to -1, all CPU cores are used.
|
|
97
|
-
max_ts_length :
|
|
99
|
+
max_ts_length : int | None, default = None
|
|
98
100
|
If not None, only the last ``max_ts_length`` time steps of each time series will be used to train the model.
|
|
99
101
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
100
102
|
"""
|
|
101
103
|
|
|
104
|
+
ag_priority = 100
|
|
102
105
|
allowed_local_model_args = ["seasonal_period"]
|
|
103
106
|
default_max_ts_length = None
|
|
104
107
|
|
|
@@ -117,7 +120,7 @@ class AverageModel(AbstractLocalModel):
|
|
|
117
120
|
|
|
118
121
|
|
|
119
122
|
class SeasonalAverageModel(AbstractLocalModel):
|
|
120
|
-
"""Baseline model that sets the forecast equal to the
|
|
123
|
+
"""Baseline model that sets the forecast equal to the historical average or quantile in the same season.
|
|
121
124
|
|
|
122
125
|
Other Parameters
|
|
123
126
|
----------------
|
|
@@ -128,16 +131,17 @@ class SeasonalAverageModel(AbstractLocalModel):
|
|
|
128
131
|
specified manually by providing an integer > 1.
|
|
129
132
|
If seasonal_period (inferred or provided) is equal to 1, will fall back to Naive forecast.
|
|
130
133
|
Seasonality will also be disabled, if the length of the time series is < seasonal_period.
|
|
131
|
-
n_jobs : int or float, default =
|
|
134
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
132
135
|
Number of CPU cores used to fit the models in parallel.
|
|
133
136
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
134
137
|
When set to a positive integer, that many cores are used.
|
|
135
138
|
When set to -1, all CPU cores are used.
|
|
136
|
-
max_ts_length :
|
|
139
|
+
max_ts_length : int | None, default = None
|
|
137
140
|
If not None, only the last ``max_ts_length`` time steps of each time series will be used to train the model.
|
|
138
141
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
139
142
|
"""
|
|
140
143
|
|
|
144
|
+
ag_priority = 100
|
|
141
145
|
allowed_local_model_args = ["seasonal_period"]
|
|
142
146
|
default_max_ts_length = None
|
|
143
147
|
|
|
@@ -26,16 +26,17 @@ class NPTSModel(AbstractLocalModel):
|
|
|
26
26
|
Number of samples generated by the forecast.
|
|
27
27
|
num_default_time_features : int, default = 1
|
|
28
28
|
Number of time features used by seasonal model.
|
|
29
|
-
n_jobs : int or float, default =
|
|
29
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
30
30
|
Number of CPU cores used to fit the models in parallel.
|
|
31
31
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
32
32
|
When set to a positive integer, that many cores are used.
|
|
33
33
|
When set to -1, all CPU cores are used.
|
|
34
|
-
max_ts_length :
|
|
34
|
+
max_ts_length : int | None, default = 2500
|
|
35
35
|
If not None, only the last ``max_ts_length`` time steps of each time series will be used to train the model.
|
|
36
36
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
+
ag_priority = 80
|
|
39
40
|
allowed_local_model_args = [
|
|
40
41
|
"kernel_type",
|
|
41
42
|
"exp_kernel_weights",
|
|
@@ -58,6 +59,11 @@ class NPTSModel(AbstractLocalModel):
|
|
|
58
59
|
) -> pd.DataFrame:
|
|
59
60
|
from gluonts.model.npts import NPTSPredictor
|
|
60
61
|
|
|
62
|
+
# NPTS model is non-deterministic due to sampling. Set seed for reproducibility in parallel processes
|
|
63
|
+
# and restore original state to avoid side effects when running with n_jobs=1
|
|
64
|
+
original_random_state = np.random.get_state()
|
|
65
|
+
np.random.seed(123)
|
|
66
|
+
|
|
61
67
|
local_model_args.pop("seasonal_period")
|
|
62
68
|
num_samples = local_model_args.pop("num_samples")
|
|
63
69
|
num_default_time_features = local_model_args.pop("num_default_time_features")
|
|
@@ -87,6 +93,7 @@ class NPTSModel(AbstractLocalModel):
|
|
|
87
93
|
forecast_dict = {"mean": forecast.mean}
|
|
88
94
|
for q in self.quantile_levels:
|
|
89
95
|
forecast_dict[str(q)] = forecast.quantile(q)
|
|
96
|
+
np.random.set_state(original_random_state)
|
|
90
97
|
return pd.DataFrame(forecast_dict)
|
|
91
98
|
|
|
92
99
|
def _more_tags(self) -> dict:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Any,
|
|
2
|
+
from typing import Any, Type
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import pandas as pd
|
|
@@ -14,15 +14,15 @@ class AbstractStatsForecastModel(AbstractLocalModel):
|
|
|
14
14
|
|
|
15
15
|
init_time_in_seconds = 15 # numba compilation for the first run
|
|
16
16
|
|
|
17
|
-
def _update_local_model_args(self, local_model_args:
|
|
17
|
+
def _update_local_model_args(self, local_model_args: dict[str, Any]) -> dict[str, Any]:
|
|
18
18
|
seasonal_period = local_model_args.pop("seasonal_period")
|
|
19
19
|
local_model_args["season_length"] = seasonal_period
|
|
20
20
|
return local_model_args
|
|
21
21
|
|
|
22
|
-
def _get_model_type(self, variant:
|
|
22
|
+
def _get_model_type(self, variant: str | None = None) -> Type:
|
|
23
23
|
raise NotImplementedError
|
|
24
24
|
|
|
25
|
-
def _get_local_model(self, local_model_args:
|
|
25
|
+
def _get_local_model(self, local_model_args: dict):
|
|
26
26
|
local_model_args = local_model_args.copy()
|
|
27
27
|
variant = local_model_args.pop("variant", None)
|
|
28
28
|
model_type = self._get_model_type(variant)
|
|
@@ -31,7 +31,7 @@ class AbstractStatsForecastModel(AbstractLocalModel):
|
|
|
31
31
|
def _get_point_forecast(
|
|
32
32
|
self,
|
|
33
33
|
time_series: pd.Series,
|
|
34
|
-
local_model_args:
|
|
34
|
+
local_model_args: dict,
|
|
35
35
|
) -> np.ndarray:
|
|
36
36
|
return self._get_local_model(local_model_args).forecast(
|
|
37
37
|
h=self.prediction_length, y=time_series.values.ravel()
|
|
@@ -123,7 +123,7 @@ class AutoARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
123
123
|
When set to None, seasonal_period will be inferred from the frequency of the training data. Can also be
|
|
124
124
|
specified manually by providing an integer > 1.
|
|
125
125
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
126
|
-
n_jobs : int or float, default =
|
|
126
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
127
127
|
Number of CPU cores used to fit the models in parallel.
|
|
128
128
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
129
129
|
When set to a positive integer, that many cores are used.
|
|
@@ -133,6 +133,7 @@ class AutoARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
133
133
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
134
134
|
"""
|
|
135
135
|
|
|
136
|
+
ag_priority = 60
|
|
136
137
|
init_time_in_seconds = 0 # C++ models require no compilation
|
|
137
138
|
allowed_local_model_args = [
|
|
138
139
|
"d",
|
|
@@ -161,7 +162,7 @@ class AutoARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
161
162
|
local_model_args.setdefault("allowmean", True)
|
|
162
163
|
return local_model_args
|
|
163
164
|
|
|
164
|
-
def _get_model_type(self, variant:
|
|
165
|
+
def _get_model_type(self, variant: str | None = None):
|
|
165
166
|
from statsforecast.models import AutoARIMA
|
|
166
167
|
|
|
167
168
|
return AutoARIMA
|
|
@@ -175,9 +176,9 @@ class ARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
175
176
|
|
|
176
177
|
Other Parameters
|
|
177
178
|
----------------
|
|
178
|
-
order:
|
|
179
|
+
order: tuple[int, int, int], default = (1, 1, 1)
|
|
179
180
|
The (p, d, q) order of the model for the number of AR parameters, differences, and MA parameters to use.
|
|
180
|
-
seasonal_order:
|
|
181
|
+
seasonal_order: tuple[int, int, int], default = (0, 0, 0)
|
|
181
182
|
The (P, D, Q) parameters of the seasonal ARIMA model. Setting to (0, 0, 0) disables seasonality.
|
|
182
183
|
include_mean : bool, default = True
|
|
183
184
|
Should the ARIMA model include a mean term?
|
|
@@ -193,7 +194,7 @@ class ARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
193
194
|
method : {"CSS-ML", "CSS", "ML"}, default = "CSS-ML"
|
|
194
195
|
Fitting method: CSS (conditional sum of squares), ML (maximum likelihood), CSS-ML (initialize with CSS, then
|
|
195
196
|
optimize with ML).
|
|
196
|
-
fixed :
|
|
197
|
+
fixed : dict[str, float], optional
|
|
197
198
|
Dictionary containing fixed coefficients for the ARIMA model.
|
|
198
199
|
seasonal_period : int or None, default = None
|
|
199
200
|
Number of time steps in a complete seasonal cycle for seasonal models. For example, 7 for daily data with a
|
|
@@ -201,7 +202,7 @@ class ARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
201
202
|
When set to None, seasonal_period will be inferred from the frequency of the training data. Can also be
|
|
202
203
|
specified manually by providing an integer > 1.
|
|
203
204
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
204
|
-
n_jobs : int or float, default =
|
|
205
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
205
206
|
Number of CPU cores used to fit the models in parallel.
|
|
206
207
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
207
208
|
When set to a positive integer, that many cores are used.
|
|
@@ -211,6 +212,7 @@ class ARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
211
212
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
212
213
|
"""
|
|
213
214
|
|
|
215
|
+
ag_priority = 10
|
|
214
216
|
init_time_in_seconds = 0 # C++ models require no compilation
|
|
215
217
|
allowed_local_model_args = [
|
|
216
218
|
"order",
|
|
@@ -230,7 +232,7 @@ class ARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
|
230
232
|
local_model_args.setdefault("order", (1, 1, 1))
|
|
231
233
|
return local_model_args
|
|
232
234
|
|
|
233
|
-
def _get_model_type(self, variant:
|
|
235
|
+
def _get_model_type(self, variant: str | None = None):
|
|
234
236
|
from statsforecast.models import ARIMA
|
|
235
237
|
|
|
236
238
|
return ARIMA
|
|
@@ -257,7 +259,7 @@ class AutoETSModel(AbstractProbabilisticStatsForecastModel):
|
|
|
257
259
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
258
260
|
damped : bool, default = False
|
|
259
261
|
Whether to dampen the trend.
|
|
260
|
-
n_jobs : int or float, default =
|
|
262
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
261
263
|
Number of CPU cores used to fit the models in parallel.
|
|
262
264
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
263
265
|
When set to a positive integer, that many cores are used.
|
|
@@ -267,6 +269,7 @@ class AutoETSModel(AbstractProbabilisticStatsForecastModel):
|
|
|
267
269
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
268
270
|
"""
|
|
269
271
|
|
|
272
|
+
ag_priority = 70
|
|
270
273
|
init_time_in_seconds = 0 # C++ models require no compilation
|
|
271
274
|
allowed_local_model_args = [
|
|
272
275
|
"damped",
|
|
@@ -274,7 +277,7 @@ class AutoETSModel(AbstractProbabilisticStatsForecastModel):
|
|
|
274
277
|
"seasonal_period",
|
|
275
278
|
]
|
|
276
279
|
|
|
277
|
-
def _get_model_type(self, variant:
|
|
280
|
+
def _get_model_type(self, variant: str | None = None):
|
|
278
281
|
from statsforecast.models import AutoETS
|
|
279
282
|
|
|
280
283
|
return AutoETS
|
|
@@ -320,7 +323,7 @@ class ETSModel(AutoETSModel):
|
|
|
320
323
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
321
324
|
damped : bool, default = False
|
|
322
325
|
Whether to dampen the trend.
|
|
323
|
-
n_jobs : int or float, default =
|
|
326
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
324
327
|
Number of CPU cores used to fit the models in parallel.
|
|
325
328
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
326
329
|
When set to a positive integer, that many cores are used.
|
|
@@ -330,6 +333,8 @@ class ETSModel(AutoETSModel):
|
|
|
330
333
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
331
334
|
"""
|
|
332
335
|
|
|
336
|
+
ag_priority = 80
|
|
337
|
+
|
|
333
338
|
def _update_local_model_args(self, local_model_args: dict) -> dict:
|
|
334
339
|
local_model_args = super()._update_local_model_args(local_model_args)
|
|
335
340
|
local_model_args.setdefault("model", "AAA")
|
|
@@ -359,7 +364,7 @@ class DynamicOptimizedThetaModel(AbstractProbabilisticStatsForecastModel):
|
|
|
359
364
|
When set to None, seasonal_period will be inferred from the frequency of the training data. Can also be
|
|
360
365
|
specified manually by providing an integer > 1.
|
|
361
366
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
362
|
-
n_jobs : int or float, default =
|
|
367
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
363
368
|
Number of CPU cores used to fit the models in parallel.
|
|
364
369
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
365
370
|
When set to a positive integer, that many cores are used.
|
|
@@ -369,12 +374,13 @@ class DynamicOptimizedThetaModel(AbstractProbabilisticStatsForecastModel):
|
|
|
369
374
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
370
375
|
"""
|
|
371
376
|
|
|
377
|
+
ag_priority = 75
|
|
372
378
|
allowed_local_model_args = [
|
|
373
379
|
"decomposition_type",
|
|
374
380
|
"seasonal_period",
|
|
375
381
|
]
|
|
376
382
|
|
|
377
|
-
def _get_model_type(self, variant:
|
|
383
|
+
def _get_model_type(self, variant: str | None = None):
|
|
378
384
|
from statsforecast.models import DynamicOptimizedTheta
|
|
379
385
|
|
|
380
386
|
return DynamicOptimizedTheta
|
|
@@ -403,7 +409,7 @@ class ThetaModel(AbstractProbabilisticStatsForecastModel):
|
|
|
403
409
|
When set to None, seasonal_period will be inferred from the frequency of the training data. Can also be
|
|
404
410
|
specified manually by providing an integer > 1.
|
|
405
411
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
406
|
-
n_jobs : int or float, default =
|
|
412
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
407
413
|
Number of CPU cores used to fit the models in parallel.
|
|
408
414
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
409
415
|
When set to a positive integer, that many cores are used.
|
|
@@ -413,12 +419,13 @@ class ThetaModel(AbstractProbabilisticStatsForecastModel):
|
|
|
413
419
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
414
420
|
"""
|
|
415
421
|
|
|
422
|
+
ag_priority = 75
|
|
416
423
|
allowed_local_model_args = [
|
|
417
424
|
"decomposition_type",
|
|
418
425
|
"seasonal_period",
|
|
419
426
|
]
|
|
420
427
|
|
|
421
|
-
def _get_model_type(self, variant:
|
|
428
|
+
def _get_model_type(self, variant: str | None = None):
|
|
422
429
|
from statsforecast.models import Theta
|
|
423
430
|
|
|
424
431
|
return Theta
|
|
@@ -442,7 +449,7 @@ class AbstractConformalizedStatsForecastModel(AbstractStatsForecastModel):
|
|
|
442
449
|
def _get_nonconformity_scores(
|
|
443
450
|
self,
|
|
444
451
|
time_series: pd.Series,
|
|
445
|
-
local_model_args:
|
|
452
|
+
local_model_args: dict,
|
|
446
453
|
) -> np.ndarray:
|
|
447
454
|
h = self.prediction_length
|
|
448
455
|
y = time_series.values.ravel()
|
|
@@ -523,7 +530,7 @@ class AutoCESModel(AbstractProbabilisticStatsForecastModel):
|
|
|
523
530
|
When set to None, seasonal_period will be inferred from the frequency of the training data. Can also be
|
|
524
531
|
specified manually by providing an integer > 1.
|
|
525
532
|
If seasonal_period (inferred or provided) is equal to 1, seasonality will be disabled.
|
|
526
|
-
n_jobs : int or float, default =
|
|
533
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
527
534
|
Number of CPU cores used to fit the models in parallel.
|
|
528
535
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
529
536
|
When set to a positive integer, that many cores are used.
|
|
@@ -533,12 +540,13 @@ class AutoCESModel(AbstractProbabilisticStatsForecastModel):
|
|
|
533
540
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
534
541
|
"""
|
|
535
542
|
|
|
543
|
+
ag_priority = 10
|
|
536
544
|
allowed_local_model_args = [
|
|
537
545
|
"model",
|
|
538
546
|
"seasonal_period",
|
|
539
547
|
]
|
|
540
548
|
|
|
541
|
-
def _get_model_type(self, variant:
|
|
549
|
+
def _get_model_type(self, variant: str | None = None):
|
|
542
550
|
from statsforecast.models import AutoCES
|
|
543
551
|
|
|
544
552
|
return AutoCES
|
|
@@ -548,7 +556,7 @@ class AutoCESModel(AbstractProbabilisticStatsForecastModel):
|
|
|
548
556
|
local_model_args.setdefault("model", "Z")
|
|
549
557
|
return local_model_args
|
|
550
558
|
|
|
551
|
-
def _get_point_forecast(self, time_series: pd.Series, local_model_args:
|
|
559
|
+
def _get_point_forecast(self, time_series: pd.Series, local_model_args: dict):
|
|
552
560
|
# Disable seasonality if time series too short for chosen season_length or season_length == 1,
|
|
553
561
|
# otherwise model will crash
|
|
554
562
|
if len(time_series) < 5:
|
|
@@ -560,7 +568,7 @@ class AutoCESModel(AbstractProbabilisticStatsForecastModel):
|
|
|
560
568
|
|
|
561
569
|
|
|
562
570
|
class AbstractStatsForecastIntermittentDemandModel(AbstractConformalizedStatsForecastModel):
|
|
563
|
-
def _update_local_model_args(self, local_model_args:
|
|
571
|
+
def _update_local_model_args(self, local_model_args: dict[str, Any]) -> dict[str, Any]:
|
|
564
572
|
_ = local_model_args.pop("seasonal_period")
|
|
565
573
|
return local_model_args
|
|
566
574
|
|
|
@@ -590,7 +598,7 @@ class ADIDAModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
590
598
|
|
|
591
599
|
Other Parameters
|
|
592
600
|
----------------
|
|
593
|
-
n_jobs : int or float, default =
|
|
601
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
594
602
|
Number of CPU cores used to fit the models in parallel.
|
|
595
603
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
596
604
|
When set to a positive integer, that many cores are used.
|
|
@@ -600,7 +608,9 @@ class ADIDAModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
600
608
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
601
609
|
"""
|
|
602
610
|
|
|
603
|
-
|
|
611
|
+
ag_priority = 10
|
|
612
|
+
|
|
613
|
+
def _get_model_type(self, variant: str | None = None):
|
|
604
614
|
from statsforecast.models import ADIDA
|
|
605
615
|
|
|
606
616
|
return ADIDA
|
|
@@ -622,11 +632,11 @@ class CrostonModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
622
632
|
variant : {"SBA", "classic", "optimized"}, default = "SBA"
|
|
623
633
|
Variant of the Croston model that is used. Available options:
|
|
624
634
|
|
|
625
|
-
-
|
|
626
|
-
-
|
|
627
|
-
-
|
|
635
|
+
- ``"classic"`` - variant of the Croston method where the smoothing parameter is fixed to 0.1 (based on `statsforecast.models.CrostonClassic <https://nixtla.mintlify.app/statsforecast/docs/models/crostonclassic.html>`_)
|
|
636
|
+
- ``"SBA"`` - variant of the Croston method based on Syntetos-Boylan Approximation (based on `statsforecast.models.CrostonSBA <https://nixtla.mintlify.app/statsforecast/docs/models/crostonsba.html>`_)
|
|
637
|
+
- ``"optimized"`` - variant of the Croston method where the smoothing parameter is optimized (based on `statsforecast.models.CrostonOptimized <https://nixtla.mintlify.app/statsforecast/docs/models/crostonoptimized.html>`_)
|
|
628
638
|
|
|
629
|
-
n_jobs : int or float, default =
|
|
639
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
630
640
|
Number of CPU cores used to fit the models in parallel.
|
|
631
641
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
632
642
|
When set to a positive integer, that many cores are used.
|
|
@@ -636,11 +646,13 @@ class CrostonModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
636
646
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
637
647
|
"""
|
|
638
648
|
|
|
649
|
+
ag_model_aliases = ["CrostonSBA"]
|
|
650
|
+
ag_priority = 80
|
|
639
651
|
allowed_local_model_args = [
|
|
640
652
|
"variant",
|
|
641
653
|
]
|
|
642
654
|
|
|
643
|
-
def _get_model_type(self, variant:
|
|
655
|
+
def _get_model_type(self, variant: str | None = None):
|
|
644
656
|
from statsforecast.models import CrostonClassic, CrostonOptimized, CrostonSBA
|
|
645
657
|
|
|
646
658
|
model_variants = {
|
|
@@ -678,7 +690,7 @@ class IMAPAModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
678
690
|
|
|
679
691
|
Other Parameters
|
|
680
692
|
----------------
|
|
681
|
-
n_jobs : int or float, default =
|
|
693
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
682
694
|
Number of CPU cores used to fit the models in parallel.
|
|
683
695
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
684
696
|
When set to a positive integer, that many cores are used.
|
|
@@ -688,7 +700,9 @@ class IMAPAModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
688
700
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
689
701
|
"""
|
|
690
702
|
|
|
691
|
-
|
|
703
|
+
ag_priority = 10
|
|
704
|
+
|
|
705
|
+
def _get_model_type(self, variant: str | None = None):
|
|
692
706
|
from statsforecast.models import IMAPA
|
|
693
707
|
|
|
694
708
|
return IMAPA
|
|
@@ -700,7 +714,7 @@ class ZeroModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
700
714
|
|
|
701
715
|
Other Parameters
|
|
702
716
|
----------------
|
|
703
|
-
n_jobs : int or float, default =
|
|
717
|
+
n_jobs : int or float, default = joblib.cpu_count(only_physical_cores=True)
|
|
704
718
|
Number of CPU cores used to fit the models in parallel.
|
|
705
719
|
When set to a float between 0.0 and 1.0, that fraction of available CPU cores is used.
|
|
706
720
|
When set to a positive integer, that many cores are used.
|
|
@@ -710,13 +724,15 @@ class ZeroModel(AbstractStatsForecastIntermittentDemandModel):
|
|
|
710
724
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
|
711
725
|
"""
|
|
712
726
|
|
|
713
|
-
|
|
727
|
+
ag_priority = 100
|
|
728
|
+
|
|
729
|
+
def _get_model_type(self, variant: str | None = None):
|
|
714
730
|
# ZeroModel does not depend on a StatsForecast implementation
|
|
715
731
|
raise NotImplementedError
|
|
716
732
|
|
|
717
733
|
def _get_point_forecast(
|
|
718
734
|
self,
|
|
719
735
|
time_series: pd.Series,
|
|
720
|
-
local_model_args:
|
|
736
|
+
local_model_args: dict,
|
|
721
737
|
):
|
|
722
738
|
return np.zeros(self.prediction_length)
|