autogluon.timeseries 1.1.0b20240409__py3-none-any.whl → 1.1.0b20240410__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.

@@ -174,6 +174,21 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
174
174
  """
175
175
  return df
176
176
 
177
+ def _add_scale_as_static_feature(self, data: TimeSeriesDataFrame) -> TimeSeriesDataFrame:
178
+ """Add mean/std of the target column for each series as a static feature."""
179
+ data = data.copy(deep=False)
180
+ scale_features = (
181
+ data[self.target]
182
+ .groupby(ITEMID, sort=False)
183
+ .agg(["mean", "std"])
184
+ .rename(columns={"mean": "__target_mean", "std": "__target_scale"})
185
+ )
186
+ if data.static_features is None:
187
+ data.static_features = scale_features
188
+ else:
189
+ data.static_features = pd.concat([data.static_features, scale_features], axis=1)
190
+ return data
191
+
177
192
  @staticmethod
178
193
  def _shorten_all_series(mlforecast_df: pd.DataFrame, max_length: int):
179
194
  logger.debug(f"Shortening all series to at most {max_length}")
@@ -252,6 +267,11 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
252
267
  if static_features is not None:
253
268
  df = pd.merge(df, static_features, how="left", on=ITEMID, suffixes=(None, "_static_feat"))
254
269
 
270
+ for col in self.metadata.known_covariates_real:
271
+ # Normalize non-boolean features using mean_abs scaling
272
+ if not df[col].isin([0, 1]).all():
273
+ df[f"__scaled_{col}"] = df[col] / df[col].abs().groupby(df[ITEMID]).mean().reindex(df[ITEMID]).values
274
+
255
275
  # We assume that df is sorted by 'unique_id' inside `TimeSeriesPredictor._check_and_prepare_data_frame`
256
276
  return df.rename(columns=column_name_mapping)
257
277
 
@@ -265,6 +285,8 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
265
285
  ) -> None:
266
286
  from mlforecast import MLForecast
267
287
 
288
+ train_data = self._add_scale_as_static_feature(train_data)
289
+
268
290
  self._check_fit_params()
269
291
  fit_start_time = time.time()
270
292
  self._train_target_median = train_data[self.target].median()
@@ -463,6 +485,7 @@ class DirectTabularModel(AbstractMLForecastModel):
463
485
  known_covariates: Optional[TimeSeriesDataFrame] = None,
464
486
  **kwargs,
465
487
  ) -> TimeSeriesDataFrame:
488
+ data = self._add_scale_as_static_feature(data)
466
489
  original_item_id_order = data.item_ids
467
490
  data, known_covariates, forecast_for_short_series = self._remove_short_ts_and_generate_fallback_forecast(
468
491
  data=data, known_covariates=known_covariates
@@ -479,7 +502,7 @@ class DirectTabularModel(AbstractMLForecastModel):
479
502
  # MLForecast raises exception of target contains NaN. We use inf as placeholder, replace them by NaN afterwards
480
503
  data_future[self.target] = float("inf")
481
504
  data_extended = pd.concat([data, data_future])
482
- mlforecast_df = self._to_mlforecast_df(data_extended, data.static_features)
505
+ mlforecast_df = self._to_mlforecast_df(data_extended, data_extended.static_features)
483
506
  if self._max_ts_length is not None:
484
507
  # We appended `prediction_length` time steps to each series, so increase length
485
508
  mlforecast_df = self._shorten_all_series(mlforecast_df, self._max_ts_length + self.prediction_length)
@@ -594,6 +617,7 @@ class RecursiveTabularModel(AbstractMLForecastModel):
594
617
  known_covariates: Optional[TimeSeriesDataFrame] = None,
595
618
  **kwargs,
596
619
  ) -> TimeSeriesDataFrame:
620
+ data = self._add_scale_as_static_feature(data)
597
621
  original_item_id_order = data.item_ids
598
622
  data, known_covariates, forecast_for_short_series = self._remove_short_ts_and_generate_fallback_forecast(
599
623
  data=data, known_covariates=known_covariates
@@ -185,9 +185,9 @@ class AbstractLocalModel(AbstractTimeSeriesModel):
185
185
  if end_time is not None and time.time() >= end_time:
186
186
  raise TimeLimitExceeded
187
187
 
188
+ model_failed = False
188
189
  if time_series.isna().all():
189
190
  result = self._dummy_forecast.copy()
190
- model_failed = True
191
191
  else:
192
192
  try:
193
193
  result = self._predict_with_local_model(
@@ -196,7 +196,6 @@ class AbstractLocalModel(AbstractTimeSeriesModel):
196
196
  )
197
197
  if not np.isfinite(result.values).all():
198
198
  raise RuntimeError("Forecast contains NaN or Inf values.")
199
- model_failed = False
200
199
  except Exception:
201
200
  if self.use_fallback_model:
202
201
  result = seasonal_naive_forecast(
@@ -1,3 +1,3 @@
1
1
  """This is the autogluon version file."""
2
- __version__ = '1.1.0b20240409'
2
+ __version__ = '1.1.0b20240410'
3
3
  __lite__ = False
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.1.0b20240409
4
- Summary: AutoML for Image, Text, and Tabular Data
3
+ Version: 1.1.0b20240410
4
+ Summary: Fast and Accurate ML in 3 Lines of Code
5
5
  Home-page: https://github.com/autogluon/autogluon
6
6
  Author: AutoGluon Community
7
7
  License: Apache-2.0
@@ -52,9 +52,9 @@ Requires-Dist: utilsforecast <0.0.11,>=0.0.10
52
52
  Requires-Dist: tqdm <5,>=4.38
53
53
  Requires-Dist: orjson ~=3.9
54
54
  Requires-Dist: tensorboard <3,>=2.9
55
- Requires-Dist: autogluon.core[raytune] ==1.1.0b20240409
56
- Requires-Dist: autogluon.common ==1.1.0b20240409
57
- Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost] ==1.1.0b20240409
55
+ Requires-Dist: autogluon.core[raytune] ==1.1.0b20240410
56
+ Requires-Dist: autogluon.common ==1.1.0b20240410
57
+ Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost] ==1.1.0b20240410
58
58
  Provides-Extra: all
59
59
  Requires-Dist: optimum[onnxruntime] <1.19,>=1.17 ; extra == 'all'
60
60
  Provides-Extra: chronos-onnx
@@ -75,7 +75,7 @@ Requires-Dist: black ~=23.0 ; extra == 'tests'
75
75
  <div align="center">
76
76
  <img src="https://user-images.githubusercontent.com/16392542/77208906-224aa500-6aba-11ea-96bd-e81806074030.png" width="350">
77
77
 
78
- ## AutoML for Image, Text, Time Series, and Tabular Data
78
+ ## Fast and Accurate ML in 3 Lines of Code
79
79
 
80
80
  [![Latest Release](https://img.shields.io/github/v/release/autogluon/autogluon)](https://github.com/autogluon/autogluon/releases)
81
81
  [![Conda Forge](https://img.shields.io/conda/vn/conda-forge/autogluon.svg)](https://anaconda.org/conda-forge/autogluon)
@@ -1,10 +1,10 @@
1
- autogluon.timeseries-1.1.0b20240409-py3.8-nspkg.pth,sha256=cQGwpuGPqg1GXscIwt-7PmME1OnSpD-7ixkikJ31WAY,554
1
+ autogluon.timeseries-1.1.0b20240410-py3.8-nspkg.pth,sha256=cQGwpuGPqg1GXscIwt-7PmME1OnSpD-7ixkikJ31WAY,554
2
2
  autogluon/timeseries/__init__.py,sha256=_CrLLc1fkjen7UzWoO0Os8WZoHOgvZbHKy46I8v_4k4,304
3
3
  autogluon/timeseries/evaluator.py,sha256=l642tYfTHsl8WVIq_vV6qhgAFVFr9UuZD7gLra3A_Kc,250
4
4
  autogluon/timeseries/learner.py,sha256=fPIV2p0BMWcZr5fwOkNsJrk8RxK-IYUH_VON3_YXKOQ,13750
5
5
  autogluon/timeseries/predictor.py,sha256=A-YkJGKrYGXGlmtIHd9CDMmudBSKcBdnOCJK4oGsQr8,81222
6
6
  autogluon/timeseries/splitter.py,sha256=eghGwAAN2_cxGk5aJBILgjGWtLzjxJcytMy49gg_q18,3061
7
- autogluon/timeseries/version.py,sha256=ACrO9T3KI3r4-b2HTTFpVrIdjO5Xc59N9PjfRI0dV7Y,90
7
+ autogluon/timeseries/version.py,sha256=Vl4mL3oO6llldJibuRCV0k8vPCryw3LzBE-RXX5eIE8,90
8
8
  autogluon/timeseries/configs/__init__.py,sha256=BTtHIPCYeGjqgOcvqb8qPD4VNX-ICKOg6wnkew1cPOE,98
9
9
  autogluon/timeseries/configs/presets_configs.py,sha256=ZVV8BsnGnnHPgjBtJBqF-H35MYUdzRBQ8FP7zA3_11g,1949
10
10
  autogluon/timeseries/dataset/__init__.py,sha256=UvnhAN5tjgxXTHoZMQDy64YMDj4Xxa68yY7NP4vAw0o,81
@@ -20,7 +20,7 @@ autogluon/timeseries/models/abstract/__init__.py,sha256=wvDsQAZIV0N3AwBeMaGItoQ8
20
20
  autogluon/timeseries/models/abstract/abstract_timeseries_model.py,sha256=q5yVFyFJPaMVtW48tr2Pw-hgedM5upvc-93qjN4Li68,23435
21
21
  autogluon/timeseries/models/abstract/model_trial.py,sha256=ENPg_7nsdxIvaNM0o0UShZ3x8jFlRmwRc5m0fGPC0TM,3720
22
22
  autogluon/timeseries/models/autogluon_tabular/__init__.py,sha256=r9i6jWcyeLHYClkcMSKRVsfrkBUMxpDrTATNTBc_qgQ,136
23
- autogluon/timeseries/models/autogluon_tabular/mlforecast.py,sha256=9gNuCWf8vVfVPiXppwG5l_3mLbZZ6i5pHKTM-rSk5Ww,30977
23
+ autogluon/timeseries/models/autogluon_tabular/mlforecast.py,sha256=aWH9r9wJGey8pzFDV_BWOuIx-L6Z40SED0y_clP5PBo,32111
24
24
  autogluon/timeseries/models/autogluon_tabular/utils.py,sha256=4-gTrBtizxeMVQlsuscugPqw9unaXWXhS1TVVssfzYY,2125
25
25
  autogluon/timeseries/models/chronos/__init__.py,sha256=wT77HzTtmQxW3sw2k0mA5Ot6PSHivX-Uvn5fjM05EU4,60
26
26
  autogluon/timeseries/models/chronos/model.py,sha256=wG4tlTwpFiADu-KQ3TYg-hz7hGz1vPBU__DzyQrikdI,14643
@@ -34,7 +34,7 @@ autogluon/timeseries/models/gluonts/abstract_gluonts.py,sha256=X1l_MexAoyBNMGiJr
34
34
  autogluon/timeseries/models/gluonts/torch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  autogluon/timeseries/models/gluonts/torch/models.py,sha256=PVDns7CnZtJTbPiCw-FJxahKrDjC-wj0VkwIGsodYY0,19930
36
36
  autogluon/timeseries/models/local/__init__.py,sha256=JyckWWgMG1BTIWJqFTW6e1O-eb0LPPOwtXwmb1ErohQ,756
37
- autogluon/timeseries/models/local/abstract_local_model.py,sha256=pbuS8G1xUisOSMaKrsfxRdmTsZTBvFjldSTn6inyr_Q,11860
37
+ autogluon/timeseries/models/local/abstract_local_model.py,sha256=6uxR97dbSmevS-mZK0zVBYFnO2Ce-S9ZxVlc0qrFLqo,11820
38
38
  autogluon/timeseries/models/local/naive.py,sha256=iwRcFMFmJKPWPbD9TWaIUS51oav69F_VAp6-jb_5SUE,7249
39
39
  autogluon/timeseries/models/local/npts.py,sha256=Bp74doKnfpGE8ywP4FWOCI_RwRMsmgocYDfGtq764DA,4143
40
40
  autogluon/timeseries/models/local/statsforecast.py,sha256=oDYKKM2LZXEQLhPLEgZZWhvSEC1iE1wBexpl8P-Cxwc,32991
@@ -52,11 +52,11 @@ autogluon/timeseries/utils/datetime/base.py,sha256=MsqIHY14m3QMjSwwtE7Uo1oNwepWU
52
52
  autogluon/timeseries/utils/datetime/lags.py,sha256=kcU4liKbHj7KP2ajNU-KLZ8OYSU35EgT4kJjZNSw0Zg,5875
53
53
  autogluon/timeseries/utils/datetime/seasonality.py,sha256=kgK_ukw2wCviEB7CZXRVC5HZpBJZu9IsRrvCJ9E_rOE,755
54
54
  autogluon/timeseries/utils/datetime/time_features.py,sha256=pROkYyxETQ8rHKfPGhf2paB73C7rWJ2Ui0cCswLqbBg,2562
55
- autogluon.timeseries-1.1.0b20240409.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
56
- autogluon.timeseries-1.1.0b20240409.dist-info/METADATA,sha256=9so2n3jb0bCI51fpMa01ZCBlBKYr1TTBof2SEaS7XN8,12543
57
- autogluon.timeseries-1.1.0b20240409.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
58
- autogluon.timeseries-1.1.0b20240409.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
59
- autogluon.timeseries-1.1.0b20240409.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
60
- autogluon.timeseries-1.1.0b20240409.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
61
- autogluon.timeseries-1.1.0b20240409.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
62
- autogluon.timeseries-1.1.0b20240409.dist-info/RECORD,,
55
+ autogluon.timeseries-1.1.0b20240410.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
56
+ autogluon.timeseries-1.1.0b20240410.dist-info/METADATA,sha256=_jsgskC0x-qRzDFtP6speD7lqYiqOSukkA3O34fLz1o,12528
57
+ autogluon.timeseries-1.1.0b20240410.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
58
+ autogluon.timeseries-1.1.0b20240410.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
59
+ autogluon.timeseries-1.1.0b20240410.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
60
+ autogluon.timeseries-1.1.0b20240410.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
61
+ autogluon.timeseries-1.1.0b20240410.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
62
+ autogluon.timeseries-1.1.0b20240410.dist-info/RECORD,,