autogluon.timeseries 1.1.2b20241117__py3-none-any.whl → 1.1.2b20241119__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.
@@ -8,7 +8,7 @@ import pandas as pd
8
8
  from autogluon.timeseries import TimeSeriesDataFrame
9
9
 
10
10
  from .abstract import TimeSeriesScorer
11
- from .utils import _in_sample_abs_seasonal_error, _in_sample_squared_seasonal_error
11
+ from .utils import in_sample_abs_seasonal_error, in_sample_squared_seasonal_error
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
@@ -232,7 +232,7 @@ class MASE(TimeSeriesScorer):
232
232
  def save_past_metrics(
233
233
  self, data_past: TimeSeriesDataFrame, target: str = "target", seasonal_period: int = 1, **kwargs
234
234
  ) -> None:
235
- self._past_abs_seasonal_error = _in_sample_abs_seasonal_error(
235
+ self._past_abs_seasonal_error = in_sample_abs_seasonal_error(
236
236
  y_past=data_past[target], seasonal_period=seasonal_period
237
237
  )
238
238
 
@@ -292,7 +292,7 @@ class RMSSE(TimeSeriesScorer):
292
292
  def save_past_metrics(
293
293
  self, data_past: TimeSeriesDataFrame, target: str = "target", seasonal_period: int = 1, **kwargs
294
294
  ) -> None:
295
- self._past_squared_seasonal_error = _in_sample_squared_seasonal_error(
295
+ self._past_squared_seasonal_error = in_sample_squared_seasonal_error(
296
296
  y_past=data_past[target], seasonal_period=seasonal_period
297
297
  )
298
298
 
@@ -6,7 +6,7 @@ import pandas as pd
6
6
  from autogluon.timeseries.dataset.ts_dataframe import TimeSeriesDataFrame
7
7
 
8
8
  from .abstract import TimeSeriesScorer
9
- from .utils import _in_sample_abs_seasonal_error
9
+ from .utils import in_sample_abs_seasonal_error
10
10
 
11
11
 
12
12
  class WQL(TimeSeriesScorer):
@@ -85,7 +85,7 @@ class SQL(TimeSeriesScorer):
85
85
  def save_past_metrics(
86
86
  self, data_past: TimeSeriesDataFrame, target: str = "target", seasonal_period: int = 1, **kwargs
87
87
  ) -> None:
88
- self._past_abs_seasonal_error = _in_sample_abs_seasonal_error(
88
+ self._past_abs_seasonal_error = in_sample_abs_seasonal_error(
89
89
  y_past=data_past[target], seasonal_period=seasonal_period
90
90
  )
91
91
 
@@ -7,12 +7,12 @@ def _get_seasonal_diffs(*, y_past: pd.Series, seasonal_period: int = 1) -> pd.Se
7
7
  return y_past.groupby(level=ITEMID, sort=False).diff(seasonal_period).abs()
8
8
 
9
9
 
10
- def _in_sample_abs_seasonal_error(*, y_past: pd.Series, seasonal_period: int = 1) -> pd.Series:
10
+ def in_sample_abs_seasonal_error(*, y_past: pd.Series, seasonal_period: int = 1) -> pd.Series:
11
11
  """Compute seasonal naive forecast error (predict value from seasonal_period steps ago) for each time series."""
12
12
  seasonal_diffs = _get_seasonal_diffs(y_past=y_past, seasonal_period=seasonal_period)
13
13
  return seasonal_diffs.groupby(level=ITEMID, sort=False).mean().fillna(1.0)
14
14
 
15
15
 
16
- def _in_sample_squared_seasonal_error(*, y_past: pd.Series, seasonal_period: int = 1) -> pd.Series:
16
+ def in_sample_squared_seasonal_error(*, y_past: pd.Series, seasonal_period: int = 1) -> pd.Series:
17
17
  seasonal_diffs = _get_seasonal_diffs(y_past=y_past, seasonal_period=seasonal_period)
18
18
  return seasonal_diffs.pow(2.0).groupby(level=ITEMID, sort=False).mean().fillna(1.0)
@@ -11,6 +11,7 @@ from sklearn.base import BaseEstimator
11
11
  import autogluon.core as ag
12
12
  from autogluon.tabular import TabularPredictor
13
13
  from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TIMESTAMP, TimeSeriesDataFrame
14
+ from autogluon.timeseries.metrics.utils import in_sample_squared_seasonal_error
14
15
  from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
15
16
  from autogluon.timeseries.models.local import SeasonalNaiveModel
16
17
  from autogluon.timeseries.utils.datetime import (
@@ -82,7 +83,6 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
82
83
  self._mlf: Optional[MLForecast] = None
83
84
  self._scaler: Optional[BaseTargetTransform] = None
84
85
  self._residuals_std_per_item: Optional[pd.Series] = None
85
- self._avg_residuals_std: Optional[float] = None
86
86
  self._train_target_median: Optional[float] = None
87
87
  self._non_boolean_real_covariates: List[str] = []
88
88
 
@@ -332,7 +332,7 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
332
332
  def _save_residuals_std(self, val_df: pd.DataFrame) -> None:
333
333
  """Compute standard deviation of residuals for each item using the validation set.
334
334
 
335
- Saves per-item residuals to `self.residuals_std_per_item` and average std to `self._avg_residuals_std`.
335
+ Saves per-item residuals to `self.residuals_std_per_item`.
336
336
  """
337
337
  residuals_df = val_df[[MLF_ITEMID, MLF_TARGET]]
338
338
  residuals_df = residuals_df.assign(y_pred=self._mlf.models_["mean"].predict(val_df))
@@ -344,7 +344,6 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
344
344
  self._residuals_std_per_item = (
345
345
  residuals.pow(2.0).groupby(val_df[MLF_ITEMID].values, sort=False).mean().pow(0.5)
346
346
  )
347
- self._avg_residuals_std = np.sqrt(residuals.pow(2.0).mean())
348
347
 
349
348
  def _remove_short_ts_and_generate_fallback_forecast(
350
349
  self,
@@ -391,7 +390,7 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
391
390
  forecast_for_short_series = None
392
391
  return data_long, known_covariates_long, forecast_for_short_series
393
392
 
394
- def _add_gaussian_quantiles(self, predictions: pd.DataFrame, repeated_item_ids: pd.Series):
393
+ def _add_gaussian_quantiles(self, predictions: pd.DataFrame, repeated_item_ids: pd.Series, past_target: pd.Series):
395
394
  """
396
395
  Add quantile levels assuming that residuals follow normal distribution
397
396
  """
@@ -403,9 +402,14 @@ class AbstractMLForecastModel(AbstractTimeSeriesModel):
403
402
  normal_scale_per_timestep = pd.Series(np.tile(sqrt_h, num_items), index=repeated_item_ids)
404
403
 
405
404
  residuals_std_per_timestep = self._residuals_std_per_item.reindex(repeated_item_ids)
406
- # Use avg_residuals_std in case unseen item received for prediction
407
- if residuals_std_per_timestep.isna().any():
408
- residuals_std_per_timestep = residuals_std_per_timestep.fillna(value=self._avg_residuals_std)
405
+ # Use in-sample seasonal error in for items not seen during fit
406
+ items_not_seen_during_fit = residuals_std_per_timestep.index[residuals_std_per_timestep.isna()].unique()
407
+ if len(items_not_seen_during_fit) > 0:
408
+ scale_for_new_items: pd.Series = np.sqrt(
409
+ in_sample_squared_seasonal_error(y_past=past_target.loc[items_not_seen_during_fit])
410
+ )
411
+ residuals_std_per_timestep = residuals_std_per_timestep.fillna(scale_for_new_items)
412
+
409
413
  std_per_timestep = residuals_std_per_timestep * normal_scale_per_timestep
410
414
  for q in self.quantile_levels:
411
415
  predictions[str(q)] = predictions["mean"] + norm.ppf(q) * std_per_timestep.to_numpy()
@@ -493,7 +497,6 @@ class DirectTabularModel(AbstractMLForecastModel):
493
497
  if self.is_quantile_model:
494
498
  # Quantile model does not require residuals to produce prediction intervals
495
499
  self._residuals_std_per_item = pd.Series(1.0, index=val_df[MLF_ITEMID].unique())
496
- self._avg_residuals_std = 1.0
497
500
  else:
498
501
  super()._save_residuals_std(val_df=val_df)
499
502
 
@@ -545,7 +548,9 @@ class DirectTabularModel(AbstractMLForecastModel):
545
548
  predictions = apply_inverse_transform(predictions, transform=tfm)
546
549
 
547
550
  if not self.is_quantile_model:
548
- predictions = self._add_gaussian_quantiles(predictions, repeated_item_ids=predictions[MLF_ITEMID])
551
+ predictions = self._add_gaussian_quantiles(
552
+ predictions, repeated_item_ids=predictions[MLF_ITEMID], past_target=data[self.target]
553
+ )
549
554
  predictions = TimeSeriesDataFrame(predictions.rename(columns={MLF_ITEMID: ITEMID, MLF_TIMESTAMP: TIMESTAMP}))
550
555
 
551
556
  if forecast_for_short_series is not None:
@@ -661,7 +666,9 @@ class RecursiveTabularModel(AbstractMLForecastModel):
661
666
  )
662
667
  predictions = raw_predictions.rename(columns={MLF_ITEMID: ITEMID, MLF_TIMESTAMP: TIMESTAMP})
663
668
  predictions = TimeSeriesDataFrame(
664
- self._add_gaussian_quantiles(predictions, repeated_item_ids=predictions[ITEMID])
669
+ self._add_gaussian_quantiles(
670
+ predictions, repeated_item_ids=predictions[ITEMID], past_target=data[self.target]
671
+ )
665
672
  )
666
673
 
667
674
  if forecast_for_short_series is not None:
@@ -510,7 +510,7 @@ class ChronosPipeline(BaseChronosPipeline):
510
510
  .cpu()
511
511
  .swapaxes(1, 2)
512
512
  )
513
- mean = prediction_samples.mean(axis=-1, keepdims=True)
513
+ mean = prediction_samples.mean(dim=-1, keepdim=True)
514
514
  quantiles = torch.quantile(
515
515
  prediction_samples,
516
516
  q=torch.tensor(quantile_levels, dtype=prediction_samples.dtype),
@@ -1,3 +1,3 @@
1
1
  """This is the autogluon version file."""
2
- __version__ = '1.1.2b20241117'
2
+ __version__ = '1.1.2b20241119'
3
3
  __lite__ = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.1.2b20241117
3
+ Version: 1.1.2b20241119
4
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
@@ -53,9 +53,9 @@ Requires-Dist: fugue>=0.9.0
53
53
  Requires-Dist: tqdm<5,>=4.38
54
54
  Requires-Dist: orjson~=3.9
55
55
  Requires-Dist: tensorboard<3,>=2.9
56
- Requires-Dist: autogluon.core[raytune]==1.1.2b20241117
57
- Requires-Dist: autogluon.common==1.1.2b20241117
58
- Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost]==1.1.2b20241117
56
+ Requires-Dist: autogluon.core[raytune]==1.1.2b20241119
57
+ Requires-Dist: autogluon.common==1.1.2b20241119
58
+ Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost]==1.1.2b20241119
59
59
  Provides-Extra: all
60
60
  Requires-Dist: optimum[onnxruntime]<1.20,>=1.17; extra == "all"
61
61
  Provides-Extra: chronos-onnx
@@ -1,34 +1,34 @@
1
- autogluon.timeseries-1.1.2b20241117-py3.8-nspkg.pth,sha256=cQGwpuGPqg1GXscIwt-7PmME1OnSpD-7ixkikJ31WAY,554
1
+ autogluon.timeseries-1.1.2b20241119-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=3dUxI-U6TGfNtRQUzWTvBIo1GKeXYOhxIX_q7Fed9eA,14013
5
5
  autogluon/timeseries/predictor.py,sha256=R9m-TYmlA4WoJbdYEL_AnEM26EhRIclynOfSmpO7mBk,84926
6
6
  autogluon/timeseries/regressor.py,sha256=tqQ2zWImxpuEyaAM0DeCjOZ-xcWUYZbCXsqd471xXxQ,8351
7
7
  autogluon/timeseries/splitter.py,sha256=eghGwAAN2_cxGk5aJBILgjGWtLzjxJcytMy49gg_q18,3061
8
- autogluon/timeseries/version.py,sha256=1hvS4kU1IUb-NlFd5oNdksEFtbUBGKd2TXKJ5K6_SwU,90
8
+ autogluon/timeseries/version.py,sha256=0242cKF96lnZcXGbtRmKZUi3yVY1-rAip2PtRhF89WQ,90
9
9
  autogluon/timeseries/configs/__init__.py,sha256=BTtHIPCYeGjqgOcvqb8qPD4VNX-ICKOg6wnkew1cPOE,98
10
10
  autogluon/timeseries/configs/presets_configs.py,sha256=94-yL9teDHKs2irWjP3kpewI7FE1ChYCgEgz9XHJ6gc,1965
11
11
  autogluon/timeseries/dataset/__init__.py,sha256=UvnhAN5tjgxXTHoZMQDy64YMDj4Xxa68yY7NP4vAw0o,81
12
12
  autogluon/timeseries/dataset/ts_dataframe.py,sha256=9bJQeg3HkPeVnyxzwqAJiTJGYXths7vxUV_3-OsJ6pk,48640
13
13
  autogluon/timeseries/metrics/__init__.py,sha256=LLGmYaexsx7CregV-QaHc5exjZbsJfBSVOtxHRGC0ho,2139
14
14
  autogluon/timeseries/metrics/abstract.py,sha256=9xCFQ3NaR1C0hn01M7oBd72a_CiNV-w6QFcRjwUbKYI,8183
15
- autogluon/timeseries/metrics/point.py,sha256=z366XJz3n4MFl4JkXOD6ZxL69F_j7Y-jbrwb7J3yDqk,15513
16
- autogluon/timeseries/metrics/quantile.py,sha256=owMbOAJYwVyzdRkrJpuCGUXk937GU843QndCZyp5n9Y,3967
17
- autogluon/timeseries/metrics/utils.py,sha256=eJ63TCR-UwbeJ1c2Qm7B2q-8B3sFthPgiooEccrf2Kc,912
15
+ autogluon/timeseries/metrics/point.py,sha256=b19Ed4dS_ROdkrOZIik_Q3-8deCN9IQSZXtCl8tuxto,15509
16
+ autogluon/timeseries/metrics/quantile.py,sha256=eemdLbo3y2wstnVkuA-f55YXywctUmSW1EhIW4BsoH4,3965
17
+ autogluon/timeseries/metrics/utils.py,sha256=HuDe1BNe8yJU4f_DKM913nNrUueoRaw6zhxm1-S20s0,910
18
18
  autogluon/timeseries/models/__init__.py,sha256=MYD9JJ-wUDE5B6jW6E6LU2eXQ6vflfQBvqQJkdzJa3A,1189
19
19
  autogluon/timeseries/models/presets.py,sha256=ujNt_hft_5eNkh-Wj_Na9GBdBmI-JdnBnOEHq8X0qXc,11778
20
20
  autogluon/timeseries/models/abstract/__init__.py,sha256=wvDsQAZIV0N3AwBeMaGItoQ82trEfnT-nol2AAOIxBg,102
21
21
  autogluon/timeseries/models/abstract/abstract_timeseries_model.py,sha256=B1R0PBymUAwhIGkPIt29X-J9o9Ipdu-bQR0gK-nmcRU,30320
22
22
  autogluon/timeseries/models/abstract/model_trial.py,sha256=ENPg_7nsdxIvaNM0o0UShZ3x8jFlRmwRc5m0fGPC0TM,3720
23
23
  autogluon/timeseries/models/autogluon_tabular/__init__.py,sha256=r9i6jWcyeLHYClkcMSKRVsfrkBUMxpDrTATNTBc_qgQ,136
24
- autogluon/timeseries/models/autogluon_tabular/mlforecast.py,sha256=aU82AXXbpum-rtpOGGhK0r1CSYZclgDX5qG8nNl_2Mo,33018
24
+ autogluon/timeseries/models/autogluon_tabular/mlforecast.py,sha256=vfWXLdxYlbzjKJa1qrFN-qzxgG2tiWxOSBOnmnNVxtA,33295
25
25
  autogluon/timeseries/models/autogluon_tabular/transforms.py,sha256=XVoy8KpvoeX38lHHAXq4Be9LCxKjxZ36SOFeSAICRFM,2524
26
26
  autogluon/timeseries/models/autogluon_tabular/utils.py,sha256=Fn3Vu_Q0PCtEUbtNgLp1xIblg7dOdpFlF3W5kLHgruI,63
27
27
  autogluon/timeseries/models/chronos/__init__.py,sha256=wT77HzTtmQxW3sw2k0mA5Ot6PSHivX-Uvn5fjM05EU4,60
28
28
  autogluon/timeseries/models/chronos/model.py,sha256=pkT-V6yYCxz6TTgn1mQ5QHNTdpyn_wyj7jM80vnrDFQ,30270
29
29
  autogluon/timeseries/models/chronos/pipeline/__init__.py,sha256=N-YZH9BGBoi99r5cznJe1zEEjwjIg7cOYIHZkKuJq44,247
30
30
  autogluon/timeseries/models/chronos/pipeline/base.py,sha256=aAXCKy7Jmip4BI2UdPMoPe2gdDMbJHKxEolcTx_5SYQ,5463
31
- autogluon/timeseries/models/chronos/pipeline/chronos.py,sha256=iHKyw3Juml247jl7bEbGlabtMyp3ibYEoA7rHiUC9f8,22048
31
+ autogluon/timeseries/models/chronos/pipeline/chronos.py,sha256=one9UwXja042JeXYSdenpCoIQ2DWZKpKiivnom5Epbw,22046
32
32
  autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py,sha256=2MJuik-YFgONZ3X2DciAph5So6ABys5ppQhBC81gLyk,20083
33
33
  autogluon/timeseries/models/chronos/pipeline/utils.py,sha256=_P_9m9Wl4FC2QyoKLluT4l7FLmZU2xw6G4xNcUpZE4k,13043
34
34
  autogluon/timeseries/models/ensemble/__init__.py,sha256=kFr11Gmt7lQJu9Rr8HuIPphQN5l1TsoorfbJm_O3a_s,128
@@ -60,11 +60,11 @@ autogluon/timeseries/utils/datetime/base.py,sha256=3NdsH3NDq4cVAOSoy3XpaNixyNlbj
60
60
  autogluon/timeseries/utils/datetime/lags.py,sha256=GoLtvcZ8oKb3QkoBJ9E59LSPLOP7Qjxrr2UmMSZgjyw,5909
61
61
  autogluon/timeseries/utils/datetime/seasonality.py,sha256=h_4w00iEytAz_N_EpCENQ8RCXy7KQITczrYjBgVqWkQ,764
62
62
  autogluon/timeseries/utils/datetime/time_features.py,sha256=PAXbYbQ0z_5GFbkxSNi41zLY_2-U3x0Ynm1m_WhdtGc,2572
63
- autogluon.timeseries-1.1.2b20241117.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
64
- autogluon.timeseries-1.1.2b20241117.dist-info/METADATA,sha256=TDdc_3hRS9w8jJ4FFfvn2H_qt_yKWsBzwBr3kHgA3iM,12388
65
- autogluon.timeseries-1.1.2b20241117.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
66
- autogluon.timeseries-1.1.2b20241117.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
67
- autogluon.timeseries-1.1.2b20241117.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
68
- autogluon.timeseries-1.1.2b20241117.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
69
- autogluon.timeseries-1.1.2b20241117.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
70
- autogluon.timeseries-1.1.2b20241117.dist-info/RECORD,,
63
+ autogluon.timeseries-1.1.2b20241119.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
64
+ autogluon.timeseries-1.1.2b20241119.dist-info/METADATA,sha256=I9IrNzlXQskc4xcwgmngBRT6iIDZBdmd0rvXxOWaXcQ,12388
65
+ autogluon.timeseries-1.1.2b20241119.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
66
+ autogluon.timeseries-1.1.2b20241119.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
67
+ autogluon.timeseries-1.1.2b20241119.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
68
+ autogluon.timeseries-1.1.2b20241119.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
69
+ autogluon.timeseries-1.1.2b20241119.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
70
+ autogluon.timeseries-1.1.2b20241119.dist-info/RECORD,,