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.

Files changed (108) hide show
  1. autogluon/timeseries/configs/__init__.py +3 -2
  2. autogluon/timeseries/configs/hyperparameter_presets.py +62 -0
  3. autogluon/timeseries/configs/predictor_presets.py +106 -0
  4. autogluon/timeseries/dataset/ts_dataframe.py +256 -141
  5. autogluon/timeseries/learner.py +86 -52
  6. autogluon/timeseries/metrics/__init__.py +42 -8
  7. autogluon/timeseries/metrics/abstract.py +89 -19
  8. autogluon/timeseries/metrics/point.py +142 -53
  9. autogluon/timeseries/metrics/quantile.py +46 -21
  10. autogluon/timeseries/metrics/utils.py +4 -4
  11. autogluon/timeseries/models/__init__.py +8 -2
  12. autogluon/timeseries/models/abstract/__init__.py +2 -2
  13. autogluon/timeseries/models/abstract/abstract_timeseries_model.py +361 -592
  14. autogluon/timeseries/models/abstract/model_trial.py +2 -1
  15. autogluon/timeseries/models/abstract/tunable.py +189 -0
  16. autogluon/timeseries/models/autogluon_tabular/__init__.py +2 -0
  17. autogluon/timeseries/models/autogluon_tabular/mlforecast.py +282 -194
  18. autogluon/timeseries/models/autogluon_tabular/per_step.py +513 -0
  19. autogluon/timeseries/models/autogluon_tabular/transforms.py +25 -18
  20. autogluon/timeseries/models/chronos/__init__.py +2 -1
  21. autogluon/timeseries/models/chronos/chronos2.py +361 -0
  22. autogluon/timeseries/models/chronos/model.py +219 -138
  23. autogluon/timeseries/models/chronos/{pipeline/utils.py → utils.py} +81 -50
  24. autogluon/timeseries/models/ensemble/__init__.py +37 -2
  25. autogluon/timeseries/models/ensemble/abstract.py +107 -0
  26. autogluon/timeseries/models/ensemble/array_based/__init__.py +3 -0
  27. autogluon/timeseries/models/ensemble/array_based/abstract.py +240 -0
  28. autogluon/timeseries/models/ensemble/array_based/models.py +185 -0
  29. autogluon/timeseries/models/ensemble/array_based/regressor/__init__.py +12 -0
  30. autogluon/timeseries/models/ensemble/array_based/regressor/abstract.py +88 -0
  31. autogluon/timeseries/models/ensemble/array_based/regressor/linear_stacker.py +186 -0
  32. autogluon/timeseries/models/ensemble/array_based/regressor/per_quantile_tabular.py +94 -0
  33. autogluon/timeseries/models/ensemble/array_based/regressor/tabular.py +107 -0
  34. autogluon/timeseries/models/ensemble/ensemble_selection.py +167 -0
  35. autogluon/timeseries/models/ensemble/per_item_greedy.py +172 -0
  36. autogluon/timeseries/models/ensemble/weighted/__init__.py +8 -0
  37. autogluon/timeseries/models/ensemble/weighted/abstract.py +45 -0
  38. autogluon/timeseries/models/ensemble/weighted/basic.py +91 -0
  39. autogluon/timeseries/models/ensemble/weighted/greedy.py +62 -0
  40. autogluon/timeseries/models/gluonts/__init__.py +1 -1
  41. autogluon/timeseries/models/gluonts/{abstract_gluonts.py → abstract.py} +148 -208
  42. autogluon/timeseries/models/gluonts/dataset.py +109 -0
  43. autogluon/timeseries/models/gluonts/{torch/models.py → models.py} +38 -22
  44. autogluon/timeseries/models/local/__init__.py +0 -7
  45. autogluon/timeseries/models/local/abstract_local_model.py +71 -74
  46. autogluon/timeseries/models/local/naive.py +13 -9
  47. autogluon/timeseries/models/local/npts.py +9 -2
  48. autogluon/timeseries/models/local/statsforecast.py +52 -36
  49. autogluon/timeseries/models/multi_window/multi_window_model.py +65 -45
  50. autogluon/timeseries/models/registry.py +64 -0
  51. autogluon/timeseries/models/toto/__init__.py +3 -0
  52. autogluon/timeseries/models/toto/_internal/__init__.py +9 -0
  53. autogluon/timeseries/models/toto/_internal/backbone/__init__.py +3 -0
  54. autogluon/timeseries/models/toto/_internal/backbone/attention.py +196 -0
  55. autogluon/timeseries/models/toto/_internal/backbone/backbone.py +262 -0
  56. autogluon/timeseries/models/toto/_internal/backbone/distribution.py +70 -0
  57. autogluon/timeseries/models/toto/_internal/backbone/kvcache.py +136 -0
  58. autogluon/timeseries/models/toto/_internal/backbone/rope.py +89 -0
  59. autogluon/timeseries/models/toto/_internal/backbone/rotary_embedding_torch.py +342 -0
  60. autogluon/timeseries/models/toto/_internal/backbone/scaler.py +305 -0
  61. autogluon/timeseries/models/toto/_internal/backbone/transformer.py +333 -0
  62. autogluon/timeseries/models/toto/_internal/dataset.py +165 -0
  63. autogluon/timeseries/models/toto/_internal/forecaster.py +423 -0
  64. autogluon/timeseries/models/toto/dataloader.py +108 -0
  65. autogluon/timeseries/models/toto/hf_pretrained_model.py +200 -0
  66. autogluon/timeseries/models/toto/model.py +249 -0
  67. autogluon/timeseries/predictor.py +685 -297
  68. autogluon/timeseries/regressor.py +94 -44
  69. autogluon/timeseries/splitter.py +8 -32
  70. autogluon/timeseries/trainer/__init__.py +3 -0
  71. autogluon/timeseries/trainer/ensemble_composer.py +444 -0
  72. autogluon/timeseries/trainer/model_set_builder.py +256 -0
  73. autogluon/timeseries/trainer/prediction_cache.py +149 -0
  74. autogluon/timeseries/{trainer.py → trainer/trainer.py} +387 -390
  75. autogluon/timeseries/trainer/utils.py +17 -0
  76. autogluon/timeseries/transforms/__init__.py +2 -13
  77. autogluon/timeseries/transforms/covariate_scaler.py +34 -40
  78. autogluon/timeseries/transforms/target_scaler.py +37 -20
  79. autogluon/timeseries/utils/constants.py +10 -0
  80. autogluon/timeseries/utils/datetime/lags.py +3 -5
  81. autogluon/timeseries/utils/datetime/seasonality.py +1 -3
  82. autogluon/timeseries/utils/datetime/time_features.py +2 -2
  83. autogluon/timeseries/utils/features.py +70 -47
  84. autogluon/timeseries/utils/forecast.py +19 -14
  85. autogluon/timeseries/utils/timer.py +173 -0
  86. autogluon/timeseries/utils/warning_filters.py +4 -2
  87. autogluon/timeseries/version.py +1 -1
  88. autogluon.timeseries-1.4.1b20251215-py3.11-nspkg.pth +1 -0
  89. {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/METADATA +49 -36
  90. autogluon_timeseries-1.4.1b20251215.dist-info/RECORD +103 -0
  91. {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/WHEEL +1 -1
  92. autogluon/timeseries/configs/presets_configs.py +0 -79
  93. autogluon/timeseries/evaluator.py +0 -6
  94. autogluon/timeseries/models/chronos/pipeline/__init__.py +0 -11
  95. autogluon/timeseries/models/chronos/pipeline/base.py +0 -160
  96. autogluon/timeseries/models/chronos/pipeline/chronos.py +0 -585
  97. autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py +0 -518
  98. autogluon/timeseries/models/ensemble/abstract_timeseries_ensemble.py +0 -78
  99. autogluon/timeseries/models/ensemble/greedy_ensemble.py +0 -170
  100. autogluon/timeseries/models/gluonts/torch/__init__.py +0 -0
  101. autogluon/timeseries/models/presets.py +0 -360
  102. autogluon.timeseries-1.2.1b20250224-py3.9-nspkg.pth +0 -1
  103. autogluon.timeseries-1.2.1b20250224.dist-info/RECORD +0 -68
  104. {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info/licenses}/LICENSE +0 -0
  105. {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info/licenses}/NOTICE +0 -0
  106. {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/namespace_packages.txt +0 -0
  107. {autogluon.timeseries-1.2.1b20250224.dist-info → autogluon_timeseries-1.4.1b20251215.dist-info}/top_level.txt +0 -0
  108. {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 = 0.5
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 = 0.5
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: np.ndarray,
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 historic average or quantile.
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 = 0.5
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 : Optional[int], default = None
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 historic average or quantile in the same season.
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 = 0.5
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 : Optional[int], default = None
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 = 0.5
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 : Optional[int], default = 2500
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, Dict, Optional, Type
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: Dict[str, Any]) -> Dict[str, Any]:
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: Optional[str] = None) -> Type:
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: Dict):
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: Dict,
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 = 0.5
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: Optional[str] = None):
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: Tuple[int, int, int], default = (1, 1, 1)
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: Tuple[int, int, int], default = (0, 0, 0)
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 : Dict[str, float], optional
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 = 0.5
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: Optional[str] = None):
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 = 0.5
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: Optional[str] = None):
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 = 0.5
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 = 0.5
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: Optional[str] = None):
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 = 0.5
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: Optional[str] = None):
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: Dict,
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 = 0.5
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: Optional[str] = None):
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: Dict):
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: Dict[str, Any]) -> Dict[str, Any]:
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 = 0.5
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
- def _get_model_type(self, variant: Optional[str] = None):
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
- - `"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>`_)
626
- - `"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>`_)
627
- - `"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>`_)
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 = 0.5
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: Optional[str] = None):
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 = 0.5
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
- def _get_model_type(self, variant: Optional[str] = None):
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 = 0.5
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
- def _get_model_type(self, variant: Optional[str] = None):
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: Dict,
736
+ local_model_args: dict,
721
737
  ):
722
738
  return np.zeros(self.prediction_length)