autogluon.timeseries 1.4.1b20251115__py3-none-any.whl → 1.4.1b20251218__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 (82) hide show
  1. autogluon/timeseries/configs/hyperparameter_presets.py +7 -21
  2. autogluon/timeseries/configs/predictor_presets.py +23 -39
  3. autogluon/timeseries/dataset/ts_dataframe.py +32 -34
  4. autogluon/timeseries/learner.py +67 -33
  5. autogluon/timeseries/metrics/__init__.py +4 -4
  6. autogluon/timeseries/metrics/abstract.py +8 -8
  7. autogluon/timeseries/metrics/point.py +9 -9
  8. autogluon/timeseries/metrics/quantile.py +4 -4
  9. autogluon/timeseries/models/__init__.py +2 -1
  10. autogluon/timeseries/models/abstract/abstract_timeseries_model.py +52 -39
  11. autogluon/timeseries/models/abstract/model_trial.py +2 -1
  12. autogluon/timeseries/models/abstract/tunable.py +8 -8
  13. autogluon/timeseries/models/autogluon_tabular/mlforecast.py +30 -26
  14. autogluon/timeseries/models/autogluon_tabular/per_step.py +12 -10
  15. autogluon/timeseries/models/autogluon_tabular/transforms.py +2 -2
  16. autogluon/timeseries/models/chronos/__init__.py +2 -1
  17. autogluon/timeseries/models/chronos/chronos2.py +395 -0
  18. autogluon/timeseries/models/chronos/model.py +29 -24
  19. autogluon/timeseries/models/chronos/utils.py +5 -5
  20. autogluon/timeseries/models/ensemble/__init__.py +17 -10
  21. autogluon/timeseries/models/ensemble/abstract.py +13 -9
  22. autogluon/timeseries/models/ensemble/array_based/__init__.py +2 -2
  23. autogluon/timeseries/models/ensemble/array_based/abstract.py +24 -31
  24. autogluon/timeseries/models/ensemble/array_based/models.py +146 -11
  25. autogluon/timeseries/models/ensemble/array_based/regressor/__init__.py +2 -0
  26. autogluon/timeseries/models/ensemble/array_based/regressor/abstract.py +6 -5
  27. autogluon/timeseries/models/ensemble/array_based/regressor/linear_stacker.py +186 -0
  28. autogluon/timeseries/models/ensemble/array_based/regressor/per_quantile_tabular.py +44 -83
  29. autogluon/timeseries/models/ensemble/array_based/regressor/tabular.py +21 -55
  30. autogluon/timeseries/models/ensemble/ensemble_selection.py +167 -0
  31. autogluon/timeseries/models/ensemble/per_item_greedy.py +172 -0
  32. autogluon/timeseries/models/ensemble/weighted/abstract.py +7 -3
  33. autogluon/timeseries/models/ensemble/weighted/basic.py +26 -13
  34. autogluon/timeseries/models/ensemble/weighted/greedy.py +20 -145
  35. autogluon/timeseries/models/gluonts/abstract.py +30 -29
  36. autogluon/timeseries/models/gluonts/dataset.py +9 -9
  37. autogluon/timeseries/models/gluonts/models.py +0 -7
  38. autogluon/timeseries/models/local/__init__.py +0 -7
  39. autogluon/timeseries/models/local/abstract_local_model.py +13 -16
  40. autogluon/timeseries/models/local/naive.py +2 -2
  41. autogluon/timeseries/models/local/npts.py +7 -1
  42. autogluon/timeseries/models/local/statsforecast.py +12 -12
  43. autogluon/timeseries/models/multi_window/multi_window_model.py +38 -23
  44. autogluon/timeseries/models/registry.py +3 -4
  45. autogluon/timeseries/models/toto/_internal/backbone/attention.py +3 -4
  46. autogluon/timeseries/models/toto/_internal/backbone/backbone.py +6 -6
  47. autogluon/timeseries/models/toto/_internal/backbone/rope.py +4 -9
  48. autogluon/timeseries/models/toto/_internal/backbone/rotary_embedding_torch.py +342 -0
  49. autogluon/timeseries/models/toto/_internal/backbone/scaler.py +2 -3
  50. autogluon/timeseries/models/toto/_internal/backbone/transformer.py +10 -10
  51. autogluon/timeseries/models/toto/_internal/dataset.py +2 -2
  52. autogluon/timeseries/models/toto/_internal/forecaster.py +8 -8
  53. autogluon/timeseries/models/toto/dataloader.py +4 -4
  54. autogluon/timeseries/models/toto/hf_pretrained_model.py +97 -16
  55. autogluon/timeseries/models/toto/model.py +30 -17
  56. autogluon/timeseries/predictor.py +517 -129
  57. autogluon/timeseries/regressor.py +18 -23
  58. autogluon/timeseries/splitter.py +2 -2
  59. autogluon/timeseries/trainer/ensemble_composer.py +323 -129
  60. autogluon/timeseries/trainer/model_set_builder.py +9 -9
  61. autogluon/timeseries/trainer/prediction_cache.py +16 -16
  62. autogluon/timeseries/trainer/trainer.py +235 -144
  63. autogluon/timeseries/trainer/utils.py +3 -4
  64. autogluon/timeseries/transforms/covariate_scaler.py +7 -7
  65. autogluon/timeseries/transforms/target_scaler.py +8 -8
  66. autogluon/timeseries/utils/constants.py +10 -0
  67. autogluon/timeseries/utils/datetime/lags.py +1 -3
  68. autogluon/timeseries/utils/datetime/seasonality.py +1 -3
  69. autogluon/timeseries/utils/features.py +22 -9
  70. autogluon/timeseries/utils/forecast.py +1 -2
  71. autogluon/timeseries/utils/timer.py +173 -0
  72. autogluon/timeseries/version.py +1 -1
  73. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/METADATA +23 -21
  74. autogluon_timeseries-1.4.1b20251218.dist-info/RECORD +103 -0
  75. autogluon_timeseries-1.4.1b20251115.dist-info/RECORD +0 -96
  76. /autogluon.timeseries-1.4.1b20251115-py3.9-nspkg.pth → /autogluon.timeseries-1.4.1b20251218-py3.11-nspkg.pth +0 -0
  77. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/WHEEL +0 -0
  78. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/licenses/LICENSE +0 -0
  79. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/licenses/NOTICE +0 -0
  80. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/namespace_packages.txt +0 -0
  81. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/top_level.txt +0 -0
  82. {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.4.1b20251218.dist-info}/zip-safe +0 -0
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  import time
3
- from typing import Any, Optional, Protocol, Union, overload, runtime_checkable
3
+ from typing import Any, Protocol, overload, runtime_checkable
4
4
 
5
5
  import numpy as np
6
6
  import pandas as pd
@@ -17,19 +17,19 @@ logger = logging.getLogger(__name__)
17
17
  class CovariateRegressor(Protocol):
18
18
  def is_fit(self) -> bool: ...
19
19
 
20
- def fit(self, data: TimeSeriesDataFrame, time_limit: Optional[float] = None, **kwargs) -> "CovariateRegressor": ...
20
+ def fit(self, data: TimeSeriesDataFrame, time_limit: float | None = None, **kwargs) -> "CovariateRegressor": ...
21
21
 
22
22
  def transform(self, data: TimeSeriesDataFrame) -> TimeSeriesDataFrame: ...
23
23
 
24
24
  def fit_transform(
25
- self, data: TimeSeriesDataFrame, time_limit: Optional[float] = None, **kwargs
25
+ self, data: TimeSeriesDataFrame, time_limit: float | None = None, **kwargs
26
26
  ) -> TimeSeriesDataFrame: ...
27
27
 
28
28
  def inverse_transform(
29
29
  self,
30
30
  predictions: TimeSeriesDataFrame,
31
31
  known_covariates: TimeSeriesDataFrame,
32
- static_features: Optional[pd.DataFrame],
32
+ static_features: pd.DataFrame | None,
33
33
  ) -> TimeSeriesDataFrame: ...
34
34
 
35
35
 
@@ -75,24 +75,19 @@ class GlobalCovariateRegressor(CovariateRegressor):
75
75
  def __init__(
76
76
  self,
77
77
  model_name: str = "CAT",
78
- model_hyperparameters: Optional[dict[str, Any]] = None,
78
+ model_hyperparameters: dict[str, Any] | None = None,
79
79
  eval_metric: str = "mean_absolute_error",
80
80
  refit_during_predict: bool = False,
81
- max_num_samples: Optional[int] = 500_000,
82
- covariate_metadata: Optional[CovariateMetadata] = None,
81
+ max_num_samples: int | None = 500_000,
82
+ covariate_metadata: CovariateMetadata | None = None,
83
83
  target: str = "target",
84
- validation_fraction: Optional[float] = 0.1,
84
+ validation_fraction: float | None = 0.1,
85
85
  fit_time_fraction: float = 0.5,
86
86
  include_static_features: bool = True,
87
87
  include_item_id: bool = False,
88
88
  ):
89
- tabular_model_types = tabular_ag_model_registry.key_to_cls_map()
90
- if model_name not in tabular_model_types:
91
- raise ValueError(
92
- f"Tabular model {model_name} not supported. Available models: {list(tabular_model_types)}"
93
- )
94
89
  self.target = target
95
- self.model_type = tabular_model_types[model_name]
90
+ self.model_type = tabular_ag_model_registry.key_to_cls(model_name)
96
91
  self.model_name = model_name
97
92
  self.model_hyperparameters = model_hyperparameters or {}
98
93
  self.refit_during_predict = refit_during_predict
@@ -103,14 +98,14 @@ class GlobalCovariateRegressor(CovariateRegressor):
103
98
  self.include_static_features = include_static_features
104
99
  self.include_item_id = include_item_id
105
100
 
106
- self.model: Optional[AbstractModel] = None
101
+ self.model: AbstractModel | None = None
107
102
  self.disabled = False
108
103
  self.covariate_metadata = covariate_metadata or CovariateMetadata()
109
104
 
110
105
  def is_fit(self) -> bool:
111
106
  return self.model is not None
112
107
 
113
- def fit(self, data: TimeSeriesDataFrame, time_limit: Optional[float] = None, **kwargs) -> "CovariateRegressor":
108
+ def fit(self, data: TimeSeriesDataFrame, time_limit: float | None = None, **kwargs) -> "CovariateRegressor":
114
109
  """Fit the tabular regressor on the target column using covariates as features."""
115
110
  start_time = time.monotonic()
116
111
  tabular_df = self._get_tabular_df(data, static_features=data.static_features, include_target=True)
@@ -178,7 +173,7 @@ class GlobalCovariateRegressor(CovariateRegressor):
178
173
  return data
179
174
 
180
175
  def fit_transform(
181
- self, data: TimeSeriesDataFrame, time_limit: Optional[float] = None, **kwargs
176
+ self, data: TimeSeriesDataFrame, time_limit: float | None = None, **kwargs
182
177
  ) -> TimeSeriesDataFrame:
183
178
  if not self.is_fit() or self.refit_during_predict:
184
179
  self.fit(data=data, time_limit=time_limit, **kwargs)
@@ -188,7 +183,7 @@ class GlobalCovariateRegressor(CovariateRegressor):
188
183
  self,
189
184
  predictions: TimeSeriesDataFrame,
190
185
  known_covariates: TimeSeriesDataFrame,
191
- static_features: Optional[pd.DataFrame],
186
+ static_features: pd.DataFrame | None,
192
187
  ) -> TimeSeriesDataFrame:
193
188
  """Add the tabular regressor predictions to the target column."""
194
189
  if not self.disabled:
@@ -196,7 +191,7 @@ class GlobalCovariateRegressor(CovariateRegressor):
196
191
  predictions = predictions.assign(**{col: predictions[col] + y_pred for col in predictions.columns})
197
192
  return predictions
198
193
 
199
- def _predict(self, data: TimeSeriesDataFrame, static_features: Optional[pd.DataFrame]) -> np.ndarray:
194
+ def _predict(self, data: TimeSeriesDataFrame, static_features: pd.DataFrame | None) -> np.ndarray:
200
195
  """Construct the tabular features matrix and make predictions"""
201
196
  assert self.model is not None, "CovariateRegressor must be fit before calling predict."
202
197
  tabular_df = self._get_tabular_df(data, static_features=static_features)
@@ -207,7 +202,7 @@ class GlobalCovariateRegressor(CovariateRegressor):
207
202
  def _get_tabular_df(
208
203
  self,
209
204
  data: TimeSeriesDataFrame,
210
- static_features: Optional[pd.DataFrame] = None,
205
+ static_features: pd.DataFrame | None = None,
211
206
  include_target: bool = False,
212
207
  ) -> pd.DataFrame:
213
208
  """Construct a tabular dataframe from known covariates and static features."""
@@ -232,11 +227,11 @@ class GlobalCovariateRegressor(CovariateRegressor):
232
227
  def get_covariate_regressor(covariate_regressor: None, target: str, covariate_metadata: CovariateMetadata) -> None: ...
233
228
  @overload
234
229
  def get_covariate_regressor(
235
- covariate_regressor: Union[str, dict], target: str, covariate_metadata: CovariateMetadata
230
+ covariate_regressor: str | dict, target: str, covariate_metadata: CovariateMetadata
236
231
  ) -> CovariateRegressor: ...
237
232
  def get_covariate_regressor(
238
- covariate_regressor: Optional[Union[str, dict]], target: str, covariate_metadata: CovariateMetadata
239
- ) -> Optional[CovariateRegressor]:
233
+ covariate_regressor: str | dict | None, target: str, covariate_metadata: CovariateMetadata
234
+ ) -> CovariateRegressor | None:
240
235
  """Create a CovariateRegressor object based on the value of the `covariate_regressor` hyperparameter."""
241
236
  if covariate_regressor is None:
242
237
  return None
@@ -1,4 +1,4 @@
1
- from typing import Iterator, Optional
1
+ from typing import Iterator
2
2
 
3
3
  from autogluon.timeseries.dataset import TimeSeriesDataFrame
4
4
 
@@ -41,7 +41,7 @@ class ExpandingWindowSplitter(AbstractWindowSplitter):
41
41
  The end of each subsequent window is moved this many time steps forward.
42
42
  """
43
43
 
44
- def __init__(self, prediction_length: int, num_val_windows: int = 1, val_step_size: Optional[int] = None):
44
+ def __init__(self, prediction_length: int, num_val_windows: int = 1, val_step_size: int | None = None):
45
45
  super().__init__(prediction_length=prediction_length, num_val_windows=num_val_windows)
46
46
  if val_step_size is None:
47
47
  val_step_size = prediction_length