autogluon.timeseries 1.1.2b20241112__py3-none-any.whl → 1.1.2b20241113__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.
@@ -2,7 +2,7 @@ from pprint import pformat
2
2
  from typing import Type, Union
3
3
 
4
4
  from .abstract import TimeSeriesScorer
5
- from .point import MAE, MAPE, MASE, MSE, RMSE, RMSLE, RMSSE, SMAPE, WAPE
5
+ from .point import MAE, MAPE, MASE, MSE, RMSE, RMSLE, RMSSE, SMAPE, WAPE, WCD
6
6
  from .quantile import SQL, WQL
7
7
 
8
8
  __all__ = [
@@ -16,6 +16,7 @@ __all__ = [
16
16
  "RMSSE",
17
17
  "SQL",
18
18
  "WAPE",
19
+ "WCD",
19
20
  "WQL",
20
21
  ]
21
22
 
@@ -40,6 +41,11 @@ DEPRECATED_METRICS = {
40
41
  "mean_wQuantileLoss": "WQL",
41
42
  }
42
43
 
44
+ # Experimental metrics that are not yet user facing
45
+ EXPERIMENTAL_METRICS = {
46
+ "WCD": WCD,
47
+ }
48
+
43
49
 
44
50
  def check_get_evaluation_metric(
45
51
  eval_metric: Union[str, TimeSeriesScorer, Type[TimeSeriesScorer], None] = None
@@ -51,12 +57,16 @@ def check_get_evaluation_metric(
51
57
  eval_metric = eval_metric()
52
58
  elif isinstance(eval_metric, str):
53
59
  eval_metric = DEPRECATED_METRICS.get(eval_metric, eval_metric)
54
- if eval_metric.upper() not in AVAILABLE_METRICS:
60
+ metric_name = eval_metric.upper()
61
+ if metric_name in AVAILABLE_METRICS:
62
+ eval_metric = AVAILABLE_METRICS[metric_name]()
63
+ elif metric_name in EXPERIMENTAL_METRICS:
64
+ eval_metric = EXPERIMENTAL_METRICS[metric_name]()
65
+ else:
55
66
  raise ValueError(
56
67
  f"Time series metric {eval_metric} not supported. Available metrics are:\n"
57
68
  f"{pformat(sorted(AVAILABLE_METRICS.keys()))}"
58
69
  )
59
- eval_metric = AVAILABLE_METRICS[eval_metric.upper()]()
60
70
  elif eval_metric is None:
61
71
  eval_metric = AVAILABLE_METRICS[DEFAULT_METRIC_NAME]()
62
72
  else:
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import warnings
2
3
  from typing import Optional
3
4
 
4
5
  import numpy as np
@@ -359,3 +360,52 @@ class RMSLE(TimeSeriesScorer):
359
360
  seasonal_period=seasonal_period,
360
361
  **kwargs,
361
362
  )
363
+
364
+
365
+ class WCD(TimeSeriesScorer):
366
+ r"""Weighted cumulative discrepancy.
367
+
368
+ Measures the discrepancy between the cumulative sum of the forecast and the cumulative sum of the actual values.
369
+
370
+ .. math::
371
+
372
+ \operatorname{WCD} = 2 \cdot \frac{1}{N} \frac{1}{H} \sum_{i=1}^{N} \sum_{t=T+1}^{T+H} \alpha \cdot \max(0, -d_{i, t}) + (1 - \alpha) \cdot \max(0, d_{i, t})
373
+
374
+ where :math:`d_{i, t}` is the difference between the cumulative predicted value and the cumulative actual value
375
+
376
+ .. math::
377
+
378
+ d_{i, t} = \left(\sum_{s=T+1}^t f_{i, s}) - \left(\sum_{s=T+1}^t y_{i, s})
379
+
380
+ Parameters
381
+ ----------
382
+ alpha : float, default = 0.5
383
+ Values > 0.5 correspond put a stronger penalty on underpredictions (when cumulative forecast is below the
384
+ cumulative actual value). Values < 0.5 put a stronger penalty on overpredictions.
385
+ """
386
+
387
+ def __init__(self, alpha: float = 0.5):
388
+ assert 0 < alpha < 1, "alpha must be in (0, 1)"
389
+ self.alpha = alpha
390
+ self.num_items: Optional[int] = None
391
+ warnings.warn(
392
+ f"{self.name} is an experimental metric. Its behavior may change in the future version of AutoGluon."
393
+ )
394
+
395
+ def save_past_metrics(self, data_past: TimeSeriesDataFrame, **kwargs) -> None:
396
+ self.num_items = data_past.num_items
397
+
398
+ def _fast_cumsum(self, y: np.ndarray) -> np.ndarray:
399
+ """Compute the cumulative sum for each consecutive `prediction_length` items in the array."""
400
+ y = y.reshape(self.num_items, -1)
401
+ return np.nancumsum(y, axis=1).ravel()
402
+
403
+ def compute_metric(
404
+ self, data_future: TimeSeriesDataFrame, predictions: TimeSeriesDataFrame, target: str = "target", **kwargs
405
+ ) -> float:
406
+ y_true, y_pred = self._get_point_forecast_score_inputs(data_future, predictions, target=target)
407
+ cumsum_true = self._fast_cumsum(y_true.to_numpy())
408
+ cumsum_pred = self._fast_cumsum(y_pred.to_numpy())
409
+ diffs = cumsum_pred - cumsum_true
410
+ error = diffs * np.where(diffs < 0, -self.alpha, (1 - self.alpha))
411
+ return 2 * self._safemean(error)
@@ -1,3 +1,3 @@
1
1
  """This is the autogluon version file."""
2
- __version__ = '1.1.2b20241112'
2
+ __version__ = '1.1.2b20241113'
3
3
  __lite__ = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.1.2b20241112
3
+ Version: 1.1.2b20241113
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.2b20241112
57
- Requires-Dist: autogluon.common==1.1.2b20241112
58
- Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost]==1.1.2b20241112
56
+ Requires-Dist: autogluon.core[raytune]==1.1.2b20241113
57
+ Requires-Dist: autogluon.common==1.1.2b20241113
58
+ Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost]==1.1.2b20241113
59
59
  Provides-Extra: all
60
60
  Requires-Dist: optimum[onnxruntime]<1.20,>=1.17; extra == "all"
61
61
  Provides-Extra: chronos-onnx
@@ -1,18 +1,18 @@
1
- autogluon.timeseries-1.1.2b20241112-py3.8-nspkg.pth,sha256=cQGwpuGPqg1GXscIwt-7PmME1OnSpD-7ixkikJ31WAY,554
1
+ autogluon.timeseries-1.1.2b20241113-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=wcYbvE7kFopdscubfhIfeLI3ovxKe_fUVtt0b1zWdV0,6823
7
7
  autogluon/timeseries/splitter.py,sha256=eghGwAAN2_cxGk5aJBILgjGWtLzjxJcytMy49gg_q18,3061
8
- autogluon/timeseries/version.py,sha256=lXKlufs6aLjs5PeI3KNuQ6bVkvRKxHvpSZbuJ-wwTeo,90
8
+ autogluon/timeseries/version.py,sha256=OGArr6c4pNSqH_iw-M1qDHQMDvnxMN7HervCqm8kQw8,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=UQ-iT2dGVJF57hlGkivbSEaBwf-5NP0Amohp4DccLUA,48492
13
- autogluon/timeseries/metrics/__init__.py,sha256=KzgXNj5or7RB_uadjgC8p5gxyV26zjj2hT58OmvnfmA,1875
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=xy8sKrBbuxZ7yTW21TDPayKnEj2FBj1AEseJxUdneqE,13399
15
+ autogluon/timeseries/metrics/point.py,sha256=z366XJz3n4MFl4JkXOD6ZxL69F_j7Y-jbrwb7J3yDqk,15513
16
16
  autogluon/timeseries/metrics/quantile.py,sha256=owMbOAJYwVyzdRkrJpuCGUXk937GU843QndCZyp5n9Y,3967
17
17
  autogluon/timeseries/metrics/utils.py,sha256=eJ63TCR-UwbeJ1c2Qm7B2q-8B3sFthPgiooEccrf2Kc,912
18
18
  autogluon/timeseries/models/__init__.py,sha256=MYD9JJ-wUDE5B6jW6E6LU2eXQ6vflfQBvqQJkdzJa3A,1189
@@ -59,11 +59,11 @@ autogluon/timeseries/utils/datetime/base.py,sha256=3NdsH3NDq4cVAOSoy3XpaNixyNlbj
59
59
  autogluon/timeseries/utils/datetime/lags.py,sha256=GoLtvcZ8oKb3QkoBJ9E59LSPLOP7Qjxrr2UmMSZgjyw,5909
60
60
  autogluon/timeseries/utils/datetime/seasonality.py,sha256=h_4w00iEytAz_N_EpCENQ8RCXy7KQITczrYjBgVqWkQ,764
61
61
  autogluon/timeseries/utils/datetime/time_features.py,sha256=PAXbYbQ0z_5GFbkxSNi41zLY_2-U3x0Ynm1m_WhdtGc,2572
62
- autogluon.timeseries-1.1.2b20241112.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
63
- autogluon.timeseries-1.1.2b20241112.dist-info/METADATA,sha256=l1LD3PIyOjR4eUt0Y-j8AmPpj0u4w1SYh9kzhvkCuZ0,12388
64
- autogluon.timeseries-1.1.2b20241112.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
65
- autogluon.timeseries-1.1.2b20241112.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
66
- autogluon.timeseries-1.1.2b20241112.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
67
- autogluon.timeseries-1.1.2b20241112.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
68
- autogluon.timeseries-1.1.2b20241112.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
69
- autogluon.timeseries-1.1.2b20241112.dist-info/RECORD,,
62
+ autogluon.timeseries-1.1.2b20241113.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
63
+ autogluon.timeseries-1.1.2b20241113.dist-info/METADATA,sha256=BtiE4lTblx5aiB8vlWmsZ3oj0Xy-lfxgWZE27eBa4fc,12388
64
+ autogluon.timeseries-1.1.2b20241113.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
65
+ autogluon.timeseries-1.1.2b20241113.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
66
+ autogluon.timeseries-1.1.2b20241113.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
67
+ autogluon.timeseries-1.1.2b20241113.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
68
+ autogluon.timeseries-1.1.2b20241113.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
69
+ autogluon.timeseries-1.1.2b20241113.dist-info/RECORD,,