autogluon.timeseries 1.2.1b20250417__tar.gz → 1.2.1b20250419__tar.gz
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.
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/PKG-INFO +1 -1
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/learner.py +1 -1
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/abstract/abstract_timeseries_model.py +9 -9
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/autogluon_tabular/mlforecast.py +2 -2
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/gluonts/abstract_gluonts.py +24 -20
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/presets.py +2 -2
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/predictor.py +2 -1
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/regressor.py +5 -4
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/trainer.py +11 -10
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/features.py +5 -2
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/version.py +1 -1
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/PKG-INFO +1 -1
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/requires.txt +3 -3
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/setup.cfg +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/setup.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/configs/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/configs/presets_configs.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/dataset/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/dataset/ts_dataframe.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/evaluator.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/metrics/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/metrics/abstract.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/metrics/point.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/metrics/quantile.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/metrics/utils.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/abstract/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/abstract/model_trial.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/abstract/tunable.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/autogluon_tabular/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/autogluon_tabular/transforms.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/autogluon_tabular/utils.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/model.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/pipeline/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/pipeline/base.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/pipeline/chronos.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/chronos/pipeline/utils.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/ensemble/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/ensemble/abstract_timeseries_ensemble.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/ensemble/greedy_ensemble.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/gluonts/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/gluonts/torch/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/gluonts/torch/models.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/local/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/local/abstract_local_model.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/local/naive.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/local/npts.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/local/statsforecast.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/multi_window/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/models/multi_window/multi_window_model.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/splitter.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/transforms/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/transforms/covariate_scaler.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/transforms/target_scaler.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/datetime/__init__.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/datetime/base.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/datetime/lags.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/datetime/seasonality.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/datetime/time_features.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/forecast.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon/timeseries/utils/warning_filters.py +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/SOURCES.txt +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/dependency_links.txt +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/namespace_packages.txt +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/top_level.txt +0 -0
- {autogluon.timeseries-1.2.1b20250417 → autogluon.timeseries-1.2.1b20250419}/src/autogluon.timeseries.egg-info/zip-safe +0 -0
@@ -88,7 +88,7 @@ class TimeSeriesLearner(AbstractLearner):
|
|
88
88
|
verbosity=kwargs.get("verbosity", 2),
|
89
89
|
skip_model_selection=kwargs.get("skip_model_selection", False),
|
90
90
|
enable_ensemble=kwargs.get("enable_ensemble", True),
|
91
|
-
|
91
|
+
covariate_metadata=self.feature_generator.covariate_metadata,
|
92
92
|
val_splitter=val_splitter,
|
93
93
|
refit_every_n_windows=refit_every_n_windows,
|
94
94
|
cache_predictions=self.cache_predictions,
|
@@ -49,7 +49,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
49
49
|
Name of the subdirectory inside path where model will be saved.
|
50
50
|
The final model directory will be os.path.join(path, name)
|
51
51
|
If None, defaults to the model's class name: self.__class__.__name__
|
52
|
-
|
52
|
+
covariate_metadata: CovariateMetadata
|
53
53
|
A mapping of different covariate types known to autogluon.timeseries to column names
|
54
54
|
in the data set.
|
55
55
|
eval_metric : Union[str, TimeSeriesScorer], default = "WQL"
|
@@ -83,7 +83,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
83
83
|
hyperparameters: Optional[Dict[str, Any]] = None,
|
84
84
|
freq: Optional[str] = None,
|
85
85
|
prediction_length: int = 1,
|
86
|
-
|
86
|
+
covariate_metadata: Optional[CovariateMetadata] = None,
|
87
87
|
target: str = "target",
|
88
88
|
quantile_levels: Sequence[float] = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9),
|
89
89
|
eval_metric: Union[str, TimeSeriesScorer, None] = None,
|
@@ -105,7 +105,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
105
105
|
self.eval_metric: TimeSeriesScorer = check_get_evaluation_metric(eval_metric)
|
106
106
|
self.eval_metric_seasonal_period = eval_metric_seasonal_period
|
107
107
|
self.target: str = target
|
108
|
-
self.
|
108
|
+
self.covariate_metadata = covariate_metadata or CovariateMetadata()
|
109
109
|
|
110
110
|
self.freq: Optional[str] = freq
|
111
111
|
self.prediction_length: int = prediction_length
|
@@ -253,7 +253,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
253
253
|
self.target_scaler = get_target_scaler(self.get_hyperparameters().get("target_scaler"), target=self.target)
|
254
254
|
self.covariate_scaler = get_covariate_scaler(
|
255
255
|
self.get_hyperparameters().get("covariate_scaler"),
|
256
|
-
covariate_metadata=self.
|
256
|
+
covariate_metadata=self.covariate_metadata,
|
257
257
|
use_static_features=self.supports_static_features,
|
258
258
|
use_known_covariates=self.supports_known_covariates,
|
259
259
|
use_past_covariates=self.supports_past_covariates,
|
@@ -261,7 +261,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
261
261
|
self.covariate_regressor = get_covariate_regressor(
|
262
262
|
self.get_hyperparameters().get("covariate_regressor"),
|
263
263
|
target=self.target,
|
264
|
-
covariate_metadata=self.
|
264
|
+
covariate_metadata=self.covariate_metadata,
|
265
265
|
)
|
266
266
|
|
267
267
|
def _get_default_hyperparameters(self) -> dict:
|
@@ -275,7 +275,6 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
275
275
|
"""
|
276
276
|
Returns a dictionary of numerous fields describing the model.
|
277
277
|
"""
|
278
|
-
# TODO: Include self.metadata
|
279
278
|
info = {
|
280
279
|
"name": self.name,
|
281
280
|
"model_type": type(self).__name__,
|
@@ -287,6 +286,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
287
286
|
"quantile_levels": self.quantile_levels,
|
288
287
|
"val_score": self.val_score,
|
289
288
|
"hyperparameters": self.get_hyperparameters(),
|
289
|
+
"covariate_metadata": self.covariate_metadata.to_dict(),
|
290
290
|
}
|
291
291
|
return info
|
292
292
|
|
@@ -351,7 +351,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
351
351
|
time steps of each time series.
|
352
352
|
"""
|
353
353
|
past_data, known_covariates = data.get_model_inputs_for_scoring(
|
354
|
-
prediction_length=self.prediction_length, known_covariates_names=self.
|
354
|
+
prediction_length=self.prediction_length, known_covariates_names=self.covariate_metadata.known_covariates
|
355
355
|
)
|
356
356
|
predictions = self.predict(past_data, known_covariates=known_covariates)
|
357
357
|
return self._score_with_predictions(data=data, predictions=predictions, metric=metric)
|
@@ -365,7 +365,7 @@ class TimeSeriesModelBase(ModelBase, ABC):
|
|
365
365
|
) -> None:
|
366
366
|
"""Compute val_score, predict_time and cache out-of-fold (OOF) predictions."""
|
367
367
|
past_data, known_covariates = val_data.get_model_inputs_for_scoring(
|
368
|
-
prediction_length=self.prediction_length, known_covariates_names=self.
|
368
|
+
prediction_length=self.prediction_length, known_covariates_names=self.covariate_metadata.known_covariates
|
369
369
|
)
|
370
370
|
predict_start_time = time.time()
|
371
371
|
oof_predictions = self.predict(past_data, known_covariates=known_covariates, **predict_kwargs)
|
@@ -661,7 +661,7 @@ class AbstractTimeSeriesModel(TimeSeriesModelBase, TimeSeriesTunable, ABC):
|
|
661
661
|
freq=self.freq,
|
662
662
|
prediction_length=self.prediction_length,
|
663
663
|
quantile_levels=self.quantile_levels,
|
664
|
-
|
664
|
+
covariate_metadata=self.covariate_metadata,
|
665
665
|
target=self.target,
|
666
666
|
)
|
667
667
|
|
@@ -263,7 +263,7 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
|
|
263
263
|
Each row contains unique_id, ds, y, and (optionally) known covariates & static features.
|
264
264
|
"""
|
265
265
|
# TODO: Add support for past_covariates
|
266
|
-
selected_columns = self.
|
266
|
+
selected_columns = self.covariate_metadata.known_covariates.copy()
|
267
267
|
column_name_mapping = {ITEMID: MLF_ITEMID, TIMESTAMP: MLF_TIMESTAMP}
|
268
268
|
if include_target:
|
269
269
|
selected_columns += [self.target]
|
@@ -297,7 +297,7 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
|
|
297
297
|
self._check_fit_params()
|
298
298
|
fit_start_time = time.time()
|
299
299
|
self._train_target_median = train_data[self.target].median()
|
300
|
-
for col in self.
|
300
|
+
for col in self.covariate_metadata.known_covariates_real:
|
301
301
|
if not set(train_data[col].unique()) == set([0, 1]):
|
302
302
|
self._non_boolean_real_covariates.append(col)
|
303
303
|
# TabularEstimator is passed to MLForecast later to include tuning_data
|
@@ -250,21 +250,21 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
250
250
|
model_params = self.get_hyperparameters()
|
251
251
|
disable_static_features = model_params.get("disable_static_features", False)
|
252
252
|
if not disable_static_features:
|
253
|
-
self.num_feat_static_cat = len(self.
|
254
|
-
self.num_feat_static_real = len(self.
|
253
|
+
self.num_feat_static_cat = len(self.covariate_metadata.static_features_cat)
|
254
|
+
self.num_feat_static_real = len(self.covariate_metadata.static_features_real)
|
255
255
|
if self.num_feat_static_cat > 0:
|
256
256
|
assert dataset.static_features is not None, (
|
257
257
|
"Static features must be provided if num_feat_static_cat > 0"
|
258
258
|
)
|
259
|
-
feat_static_cat = dataset.static_features[self.
|
259
|
+
feat_static_cat = dataset.static_features[self.covariate_metadata.static_features_cat]
|
260
260
|
self.feat_static_cat_cardinality = feat_static_cat.nunique().tolist()
|
261
261
|
|
262
262
|
disable_known_covariates = model_params.get("disable_known_covariates", False)
|
263
263
|
if not disable_known_covariates and self.supports_known_covariates:
|
264
|
-
self.num_feat_dynamic_cat = len(self.
|
265
|
-
self.num_feat_dynamic_real = len(self.
|
264
|
+
self.num_feat_dynamic_cat = len(self.covariate_metadata.known_covariates_cat)
|
265
|
+
self.num_feat_dynamic_real = len(self.covariate_metadata.known_covariates_real)
|
266
266
|
if self.num_feat_dynamic_cat > 0:
|
267
|
-
feat_dynamic_cat = dataset[self.
|
267
|
+
feat_dynamic_cat = dataset[self.covariate_metadata.known_covariates_cat]
|
268
268
|
if self.supports_cat_covariates:
|
269
269
|
self.feat_dynamic_cat_cardinality = feat_dynamic_cat.nunique().tolist()
|
270
270
|
else:
|
@@ -280,10 +280,10 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
280
280
|
|
281
281
|
disable_past_covariates = model_params.get("disable_past_covariates", False)
|
282
282
|
if not disable_past_covariates and self.supports_past_covariates:
|
283
|
-
self.num_past_feat_dynamic_cat = len(self.
|
284
|
-
self.num_past_feat_dynamic_real = len(self.
|
283
|
+
self.num_past_feat_dynamic_cat = len(self.covariate_metadata.past_covariates_cat)
|
284
|
+
self.num_past_feat_dynamic_real = len(self.covariate_metadata.past_covariates_real)
|
285
285
|
if self.num_past_feat_dynamic_cat > 0:
|
286
|
-
past_feat_dynamic_cat = dataset[self.
|
286
|
+
past_feat_dynamic_cat = dataset[self.covariate_metadata.past_covariates_cat]
|
287
287
|
if self.supports_cat_covariates:
|
288
288
|
self.past_feat_dynamic_cat_cardinality = past_feat_dynamic_cat.nunique().tolist()
|
289
289
|
else:
|
@@ -400,7 +400,9 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
400
400
|
assert time_series_df.static_features is not None, (
|
401
401
|
"Static features must be provided if num_feat_static_cat > 0"
|
402
402
|
)
|
403
|
-
feat_static_cat = time_series_df.static_features[
|
403
|
+
feat_static_cat = time_series_df.static_features[
|
404
|
+
self.covariate_metadata.static_features_cat
|
405
|
+
].to_numpy()
|
404
406
|
else:
|
405
407
|
feat_static_cat = None
|
406
408
|
|
@@ -408,7 +410,9 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
408
410
|
assert time_series_df.static_features is not None, (
|
409
411
|
"Static features must be provided if num_feat_static_real > 0"
|
410
412
|
)
|
411
|
-
feat_static_real = time_series_df.static_features[
|
413
|
+
feat_static_real = time_series_df.static_features[
|
414
|
+
self.covariate_metadata.static_features_real
|
415
|
+
].to_numpy()
|
412
416
|
else:
|
413
417
|
feat_static_real = None
|
414
418
|
|
@@ -418,31 +422,31 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
418
422
|
if known_covariates is not None:
|
419
423
|
known_covariates = pd.DataFrame(known_covariates) # type: ignore
|
420
424
|
if self.num_feat_dynamic_cat > 0:
|
421
|
-
feat_dynamic_cat = df[self.
|
425
|
+
feat_dynamic_cat = df[self.covariate_metadata.known_covariates_cat].to_numpy()
|
422
426
|
if known_covariates is not None:
|
423
427
|
feat_dynamic_cat = np.concatenate(
|
424
|
-
[feat_dynamic_cat, known_covariates[self.
|
428
|
+
[feat_dynamic_cat, known_covariates[self.covariate_metadata.known_covariates_cat].to_numpy()]
|
425
429
|
)
|
426
430
|
assert len(feat_dynamic_cat) == expected_known_covariates_len
|
427
431
|
else:
|
428
432
|
feat_dynamic_cat = None
|
429
433
|
|
430
434
|
if self.num_feat_dynamic_real > 0:
|
431
|
-
feat_dynamic_real = df[self.
|
435
|
+
feat_dynamic_real = df[self.covariate_metadata.known_covariates_real].to_numpy()
|
432
436
|
# Append future values of known covariates
|
433
437
|
if known_covariates is not None:
|
434
438
|
feat_dynamic_real = np.concatenate(
|
435
|
-
[feat_dynamic_real, known_covariates[self.
|
439
|
+
[feat_dynamic_real, known_covariates[self.covariate_metadata.known_covariates_real].to_numpy()]
|
436
440
|
)
|
437
441
|
assert len(feat_dynamic_real) == expected_known_covariates_len
|
438
442
|
# Categorical covariates are one-hot-encoded as real
|
439
443
|
if self._ohe_generator_known is not None:
|
440
444
|
feat_dynamic_cat_ohe: np.ndarray = self._ohe_generator_known.transform(
|
441
|
-
df[self.
|
445
|
+
df[self.covariate_metadata.known_covariates_cat]
|
442
446
|
) # type: ignore
|
443
447
|
if known_covariates is not None:
|
444
448
|
future_dynamic_cat_ohe: np.ndarray = self._ohe_generator_known.transform( # type: ignore
|
445
|
-
known_covariates[self.
|
449
|
+
known_covariates[self.covariate_metadata.known_covariates_cat]
|
446
450
|
)
|
447
451
|
feat_dynamic_cat_ohe = np.concatenate([feat_dynamic_cat_ohe, future_dynamic_cat_ohe])
|
448
452
|
assert len(feat_dynamic_cat_ohe) == expected_known_covariates_len
|
@@ -451,15 +455,15 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
451
455
|
feat_dynamic_real = None
|
452
456
|
|
453
457
|
if self.num_past_feat_dynamic_cat > 0:
|
454
|
-
past_feat_dynamic_cat = df[self.
|
458
|
+
past_feat_dynamic_cat = df[self.covariate_metadata.past_covariates_cat].to_numpy()
|
455
459
|
else:
|
456
460
|
past_feat_dynamic_cat = None
|
457
461
|
|
458
462
|
if self.num_past_feat_dynamic_real > 0:
|
459
|
-
past_feat_dynamic_real = df[self.
|
463
|
+
past_feat_dynamic_real = df[self.covariate_metadata.past_covariates_real].to_numpy()
|
460
464
|
if self._ohe_generator_past is not None:
|
461
465
|
past_feat_dynamic_cat_ohe: np.ndarray = self._ohe_generator_past.transform( # type: ignore
|
462
|
-
df[self.
|
466
|
+
df[self.covariate_metadata.past_covariates_cat]
|
463
467
|
)
|
464
468
|
past_feat_dynamic_real = np.concatenate(
|
465
469
|
[past_feat_dynamic_real, past_feat_dynamic_cat_ohe], axis=1
|
@@ -186,7 +186,7 @@ def get_preset_models(
|
|
186
186
|
eval_metric_seasonal_period: Optional[int],
|
187
187
|
hyperparameters: Union[str, Dict, None],
|
188
188
|
hyperparameter_tune: bool,
|
189
|
-
|
189
|
+
covariate_metadata: CovariateMetadata,
|
190
190
|
all_assigned_names: List[str],
|
191
191
|
excluded_model_types: Optional[List[str]],
|
192
192
|
multi_window: bool = False,
|
@@ -261,7 +261,7 @@ def get_preset_models(
|
|
261
261
|
prediction_length=prediction_length,
|
262
262
|
eval_metric=eval_metric,
|
263
263
|
eval_metric_seasonal_period=eval_metric_seasonal_period,
|
264
|
-
|
264
|
+
covariate_metadata=covariate_metadata,
|
265
265
|
hyperparameters=model_hps,
|
266
266
|
**kwargs,
|
267
267
|
)
|
@@ -1444,7 +1444,8 @@ class TimeSeriesPredictor:
|
|
1444
1444
|
}
|
1445
1445
|
|
1446
1446
|
past_data, known_covariates = test_data.get_model_inputs_for_scoring(
|
1447
|
-
prediction_length=self.prediction_length,
|
1447
|
+
prediction_length=self.prediction_length,
|
1448
|
+
known_covariates_names=trainer.covariate_metadata.known_covariates,
|
1448
1449
|
)
|
1449
1450
|
pred_proba_dict_test, _ = trainer.get_model_pred_dict(
|
1450
1451
|
base_model_names, data=past_data, known_covariates=known_covariates
|
@@ -6,7 +6,7 @@ import numpy as np
|
|
6
6
|
import pandas as pd
|
7
7
|
|
8
8
|
from autogluon.core.models import AbstractModel
|
9
|
-
from autogluon.tabular.
|
9
|
+
from autogluon.tabular.register import ag_model_register as tabular_ag_model_register
|
10
10
|
from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TimeSeriesDataFrame
|
11
11
|
from autogluon.timeseries.utils.features import CovariateMetadata
|
12
12
|
|
@@ -85,12 +85,13 @@ class GlobalCovariateRegressor(CovariateRegressor):
|
|
85
85
|
include_static_features: bool = True,
|
86
86
|
include_item_id: bool = False,
|
87
87
|
):
|
88
|
-
|
88
|
+
tabular_model_types = tabular_ag_model_register.key_to_cls_map()
|
89
|
+
if model_name not in tabular_model_types:
|
89
90
|
raise ValueError(
|
90
|
-
f"Tabular model {model_name} not supported. Available models: {list(
|
91
|
+
f"Tabular model {model_name} not supported. Available models: {list(tabular_model_types)}"
|
91
92
|
)
|
92
93
|
self.target = target
|
93
|
-
self.model_type =
|
94
|
+
self.model_type = tabular_model_types[model_name]
|
94
95
|
self.model_name = model_name
|
95
96
|
self.model_hyperparameters = model_hyperparameters or {}
|
96
97
|
self.refit_during_predict = refit_during_predict
|
@@ -67,7 +67,7 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
67
67
|
self.prediction_length = prediction_length
|
68
68
|
self.quantile_levels = kwargs.get("quantile_levels", [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
|
69
69
|
self.target = kwargs.get("target", "target")
|
70
|
-
self.
|
70
|
+
self.covariate_metadata = kwargs.get("covariate_metadata", CovariateMetadata())
|
71
71
|
self.is_data_saved = False
|
72
72
|
self.skip_model_selection = skip_model_selection
|
73
73
|
# Ensemble cannot be fit if val_scores are not computed
|
@@ -361,7 +361,7 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
361
361
|
model.fit_time = model.fit_time or (fit_end_time - fit_start_time)
|
362
362
|
|
363
363
|
if time_limit is not None:
|
364
|
-
time_limit = fit_end_time - fit_start_time
|
364
|
+
time_limit = time_limit - (fit_end_time - fit_start_time)
|
365
365
|
if val_data is not None and not self.skip_model_selection:
|
366
366
|
model.score_and_cache_oof(
|
367
367
|
val_data, store_val_score=True, store_predict_time=True, time_limit=time_limit
|
@@ -576,7 +576,7 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
576
576
|
path=self.path,
|
577
577
|
freq=data_per_window[0].freq,
|
578
578
|
quantile_levels=self.quantile_levels,
|
579
|
-
|
579
|
+
covariate_metadata=self.covariate_metadata,
|
580
580
|
)
|
581
581
|
with warning_filter():
|
582
582
|
ensemble.fit_ensemble(model_preds, data_per_window=data_per_window, time_limit=time_limit)
|
@@ -636,7 +636,8 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
636
636
|
|
637
637
|
if data is not None:
|
638
638
|
past_data, known_covariates = data.get_model_inputs_for_scoring(
|
639
|
-
prediction_length=self.prediction_length,
|
639
|
+
prediction_length=self.prediction_length,
|
640
|
+
known_covariates_names=self.covariate_metadata.known_covariates,
|
640
641
|
)
|
641
642
|
logger.info(
|
642
643
|
"Additional data provided, testing on additional data. Resulting leaderboard "
|
@@ -813,7 +814,7 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
813
814
|
use_cache: bool = True,
|
814
815
|
) -> Dict[str, float]:
|
815
816
|
past_data, known_covariates = data.get_model_inputs_for_scoring(
|
816
|
-
prediction_length=self.prediction_length, known_covariates_names=self.
|
817
|
+
prediction_length=self.prediction_length, known_covariates_names=self.covariate_metadata.known_covariates
|
817
818
|
)
|
818
819
|
predictions = self.predict(data=past_data, known_covariates=known_covariates, model=model, use_cache=use_cache)
|
819
820
|
|
@@ -874,7 +875,7 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
874
875
|
)
|
875
876
|
|
876
877
|
importance_transform = importance_transform_type(
|
877
|
-
covariate_metadata=self.
|
878
|
+
covariate_metadata=self.covariate_metadata,
|
878
879
|
prediction_length=self.prediction_length,
|
879
880
|
random_seed=random_seed,
|
880
881
|
)
|
@@ -937,11 +938,11 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
937
938
|
"""Check if the given model uses the given feature."""
|
938
939
|
models_with_ancestors = set(self.get_minimum_model_set(model))
|
939
940
|
|
940
|
-
if feature in self.
|
941
|
+
if feature in self.covariate_metadata.static_features:
|
941
942
|
return any(self.load_model(m).supports_static_features for m in models_with_ancestors)
|
942
|
-
elif feature in self.
|
943
|
+
elif feature in self.covariate_metadata.known_covariates:
|
943
944
|
return any(self.load_model(m).supports_known_covariates for m in models_with_ancestors)
|
944
|
-
elif feature in self.
|
945
|
+
elif feature in self.covariate_metadata.past_covariates:
|
945
946
|
return any(self.load_model(m).supports_past_covariates for m in models_with_ancestors)
|
946
947
|
|
947
948
|
return False
|
@@ -1260,7 +1261,7 @@ class TimeSeriesTrainer(AbstractTrainer[AbstractTimeSeriesModel]):
|
|
1260
1261
|
quantile_levels=self.quantile_levels,
|
1261
1262
|
all_assigned_names=self._get_banned_model_names(),
|
1262
1263
|
target=self.target,
|
1263
|
-
|
1264
|
+
covariate_metadata=self.covariate_metadata,
|
1264
1265
|
excluded_model_types=excluded_model_types,
|
1265
1266
|
# if skip_model_selection = True, we skip backtesting
|
1266
1267
|
multi_window=multi_window and not self.skip_model_selection,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import logging
|
2
2
|
import reprlib
|
3
3
|
import time
|
4
|
-
from dataclasses import dataclass, field
|
5
|
-
from typing import Any, List, Literal, Optional, Tuple
|
4
|
+
from dataclasses import asdict, dataclass, field
|
5
|
+
from typing import Any, Dict, List, Literal, Optional, Tuple
|
6
6
|
|
7
7
|
import numpy as np
|
8
8
|
import pandas as pd
|
@@ -67,6 +67,9 @@ class CovariateMetadata:
|
|
67
67
|
def all_features(self) -> List[str]:
|
68
68
|
return self.static_features + self.covariates
|
69
69
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
71
|
+
return asdict(self)
|
72
|
+
|
70
73
|
|
71
74
|
class ContinuousAndCategoricalFeatureGenerator(PipelineFeatureGenerator):
|
72
75
|
"""Generates categorical and continuous features for time series models.
|
@@ -17,9 +17,9 @@ fugue>=0.9.0
|
|
17
17
|
tqdm<5,>=4.38
|
18
18
|
orjson~=3.9
|
19
19
|
tensorboard<3,>=2.9
|
20
|
-
autogluon.core[raytune]==1.2.
|
21
|
-
autogluon.common==1.2.
|
22
|
-
autogluon.tabular[catboost,lightgbm,xgboost]==1.2.
|
20
|
+
autogluon.core[raytune]==1.2.1b20250419
|
21
|
+
autogluon.common==1.2.1b20250419
|
22
|
+
autogluon.tabular[catboost,lightgbm,xgboost]==1.2.1b20250419
|
23
23
|
|
24
24
|
[all]
|
25
25
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|