autogluon.timeseries 1.4.1b20251115__py3-none-any.whl → 1.5.0b20251221__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/hyperparameter_presets.py +13 -28
- autogluon/timeseries/configs/predictor_presets.py +23 -39
- autogluon/timeseries/dataset/ts_dataframe.py +32 -34
- autogluon/timeseries/learner.py +67 -33
- autogluon/timeseries/metrics/__init__.py +4 -4
- autogluon/timeseries/metrics/abstract.py +8 -8
- autogluon/timeseries/metrics/point.py +9 -9
- autogluon/timeseries/metrics/quantile.py +4 -4
- autogluon/timeseries/models/__init__.py +2 -1
- autogluon/timeseries/models/abstract/abstract_timeseries_model.py +52 -50
- autogluon/timeseries/models/abstract/model_trial.py +2 -1
- autogluon/timeseries/models/abstract/tunable.py +8 -8
- autogluon/timeseries/models/autogluon_tabular/mlforecast.py +30 -26
- autogluon/timeseries/models/autogluon_tabular/per_step.py +13 -11
- autogluon/timeseries/models/autogluon_tabular/transforms.py +2 -2
- autogluon/timeseries/models/chronos/__init__.py +2 -1
- autogluon/timeseries/models/chronos/chronos2.py +395 -0
- autogluon/timeseries/models/chronos/model.py +30 -25
- autogluon/timeseries/models/chronos/utils.py +5 -5
- autogluon/timeseries/models/ensemble/__init__.py +17 -10
- autogluon/timeseries/models/ensemble/abstract.py +13 -9
- autogluon/timeseries/models/ensemble/array_based/__init__.py +2 -2
- autogluon/timeseries/models/ensemble/array_based/abstract.py +24 -31
- autogluon/timeseries/models/ensemble/array_based/models.py +146 -11
- autogluon/timeseries/models/ensemble/array_based/regressor/__init__.py +2 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/abstract.py +6 -5
- autogluon/timeseries/models/ensemble/array_based/regressor/linear_stacker.py +186 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/per_quantile_tabular.py +44 -83
- autogluon/timeseries/models/ensemble/array_based/regressor/tabular.py +21 -55
- autogluon/timeseries/models/ensemble/ensemble_selection.py +167 -0
- autogluon/timeseries/models/ensemble/per_item_greedy.py +172 -0
- autogluon/timeseries/models/ensemble/weighted/abstract.py +7 -3
- autogluon/timeseries/models/ensemble/weighted/basic.py +26 -13
- autogluon/timeseries/models/ensemble/weighted/greedy.py +21 -144
- autogluon/timeseries/models/gluonts/abstract.py +30 -29
- autogluon/timeseries/models/gluonts/dataset.py +9 -9
- autogluon/timeseries/models/gluonts/models.py +0 -7
- autogluon/timeseries/models/local/__init__.py +0 -7
- autogluon/timeseries/models/local/abstract_local_model.py +13 -16
- autogluon/timeseries/models/local/naive.py +2 -2
- autogluon/timeseries/models/local/npts.py +7 -1
- autogluon/timeseries/models/local/statsforecast.py +13 -13
- autogluon/timeseries/models/multi_window/multi_window_model.py +38 -23
- autogluon/timeseries/models/registry.py +3 -4
- autogluon/timeseries/models/toto/_internal/backbone/attention.py +3 -4
- autogluon/timeseries/models/toto/_internal/backbone/backbone.py +6 -6
- autogluon/timeseries/models/toto/_internal/backbone/rope.py +4 -9
- autogluon/timeseries/models/toto/_internal/backbone/rotary_embedding_torch.py +342 -0
- autogluon/timeseries/models/toto/_internal/backbone/scaler.py +2 -3
- autogluon/timeseries/models/toto/_internal/backbone/transformer.py +10 -10
- autogluon/timeseries/models/toto/_internal/dataset.py +2 -2
- autogluon/timeseries/models/toto/_internal/forecaster.py +8 -8
- autogluon/timeseries/models/toto/dataloader.py +4 -4
- autogluon/timeseries/models/toto/hf_pretrained_model.py +97 -16
- autogluon/timeseries/models/toto/model.py +30 -17
- autogluon/timeseries/predictor.py +531 -136
- autogluon/timeseries/regressor.py +18 -23
- autogluon/timeseries/splitter.py +2 -2
- autogluon/timeseries/trainer/ensemble_composer.py +323 -129
- autogluon/timeseries/trainer/model_set_builder.py +9 -9
- autogluon/timeseries/trainer/prediction_cache.py +16 -16
- autogluon/timeseries/trainer/trainer.py +235 -145
- autogluon/timeseries/trainer/utils.py +3 -4
- autogluon/timeseries/transforms/covariate_scaler.py +7 -7
- autogluon/timeseries/transforms/target_scaler.py +8 -8
- autogluon/timeseries/utils/constants.py +10 -0
- autogluon/timeseries/utils/datetime/lags.py +1 -3
- autogluon/timeseries/utils/datetime/seasonality.py +1 -3
- autogluon/timeseries/utils/features.py +22 -9
- autogluon/timeseries/utils/forecast.py +1 -2
- autogluon/timeseries/utils/timer.py +173 -0
- autogluon/timeseries/version.py +1 -1
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/METADATA +23 -21
- autogluon_timeseries-1.5.0b20251221.dist-info/RECORD +103 -0
- autogluon_timeseries-1.4.1b20251115.dist-info/RECORD +0 -96
- /autogluon.timeseries-1.4.1b20251115-py3.9-nspkg.pth → /autogluon.timeseries-1.5.0b20251221-py3.11-nspkg.pth +0 -0
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/WHEEL +0 -0
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/licenses/LICENSE +0 -0
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/licenses/NOTICE +0 -0
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/namespace_packages.txt +0 -0
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/top_level.txt +0 -0
- {autogluon_timeseries-1.4.1b20251115.dist-info → autogluon_timeseries-1.5.0b20251221.dist-info}/zip-safe +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import time
|
|
3
|
-
from typing import Any,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
82
|
-
covariate_metadata:
|
|
81
|
+
max_num_samples: int | None = 500_000,
|
|
82
|
+
covariate_metadata: CovariateMetadata | None = None,
|
|
83
83
|
target: str = "target",
|
|
84
|
-
validation_fraction:
|
|
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 =
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
230
|
+
covariate_regressor: str | dict, target: str, covariate_metadata: CovariateMetadata
|
|
236
231
|
) -> CovariateRegressor: ...
|
|
237
232
|
def get_covariate_regressor(
|
|
238
|
-
covariate_regressor:
|
|
239
|
-
) ->
|
|
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
|
autogluon/timeseries/splitter.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Iterator
|
|
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:
|
|
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
|