autogluon.timeseries 1.2.1b20250422__py3-none-any.whl → 1.2.1b20250423__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.
- autogluon/timeseries/dataset/ts_dataframe.py +1 -1
- autogluon/timeseries/learner.py +0 -4
- autogluon/timeseries/metrics/__init__.py +1 -30
- autogluon/timeseries/metrics/abstract.py +0 -10
- autogluon/timeseries/metrics/point.py +41 -131
- autogluon/timeseries/metrics/quantile.py +15 -36
- autogluon/timeseries/models/abstract/__init__.py +2 -2
- autogluon/timeseries/models/abstract/abstract_timeseries_model.py +178 -129
- autogluon/timeseries/models/chronos/model.py +3 -2
- autogluon/timeseries/models/ensemble/__init__.py +3 -2
- autogluon/timeseries/models/ensemble/abstract.py +139 -0
- autogluon/timeseries/models/ensemble/basic.py +88 -0
- autogluon/timeseries/models/ensemble/{greedy_ensemble.py → greedy.py} +67 -61
- autogluon/timeseries/models/presets.py +0 -4
- autogluon/timeseries/predictor.py +1 -12
- autogluon/timeseries/trainer.py +35 -27
- autogluon/timeseries/version.py +1 -1
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/METADATA +4 -4
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/RECORD +26 -25
- autogluon/timeseries/models/ensemble/abstract_timeseries_ensemble.py +0 -86
- /autogluon.timeseries-1.2.1b20250422-py3.9-nspkg.pth → /autogluon.timeseries-1.2.1b20250423-py3.9-nspkg.pth +0 -0
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/LICENSE +0 -0
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/NOTICE +0 -0
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/WHEEL +0 -0
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/namespace_packages.txt +0 -0
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/top_level.txt +0 -0
- {autogluon.timeseries-1.2.1b20250422.dist-info → autogluon.timeseries-1.2.1b20250423.dist-info}/zip-safe +0 -0
@@ -1,86 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
from typing import Dict, List, Optional
|
3
|
-
|
4
|
-
from autogluon.core.utils.exceptions import TimeLimitExceeded
|
5
|
-
from autogluon.timeseries.dataset import TimeSeriesDataFrame
|
6
|
-
from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
|
7
|
-
|
8
|
-
logger = logging.getLogger(__name__)
|
9
|
-
|
10
|
-
|
11
|
-
class AbstractTimeSeriesEnsembleModel(AbstractTimeSeriesModel):
|
12
|
-
"""Abstract class for time series ensemble models."""
|
13
|
-
|
14
|
-
@property
|
15
|
-
def model_names(self) -> List[str]:
|
16
|
-
"""Names of base models included in the ensemble."""
|
17
|
-
raise NotImplementedError
|
18
|
-
|
19
|
-
def fit_ensemble(
|
20
|
-
self,
|
21
|
-
predictions_per_window: Dict[str, List[TimeSeriesDataFrame]],
|
22
|
-
data_per_window: List[TimeSeriesDataFrame],
|
23
|
-
time_limit: Optional[float] = None,
|
24
|
-
**kwargs,
|
25
|
-
):
|
26
|
-
"""Fit ensemble model given predictions of candidate base models and the true data.
|
27
|
-
|
28
|
-
Parameters
|
29
|
-
----------
|
30
|
-
predictions_per_window : Dict[str, List[TimeSeriesDataFrame]]
|
31
|
-
Dictionary that maps the names of component models to their respective predictions for each validation
|
32
|
-
window.
|
33
|
-
data_per_window : List[TimeSeriesDataFrame]
|
34
|
-
Observed ground truth data used to train the ensemble for each validation window. Each entry in the list
|
35
|
-
includes both the forecast horizon (for which the predictions are given in ``predictions``), as well as the
|
36
|
-
"history".
|
37
|
-
time_limit : Optional[int]
|
38
|
-
Maximum allowed time for training in seconds.
|
39
|
-
"""
|
40
|
-
if time_limit is not None and time_limit <= 0:
|
41
|
-
logger.warning(
|
42
|
-
f"\tWarning: Model has no time left to train, skipping model... (Time Left = {round(time_limit, 1)}s)"
|
43
|
-
)
|
44
|
-
raise TimeLimitExceeded
|
45
|
-
if isinstance(data_per_window, TimeSeriesDataFrame):
|
46
|
-
raise ValueError("When fitting ensemble, `data` should contain ground truth for each validation window")
|
47
|
-
num_val_windows = len(data_per_window)
|
48
|
-
for model, preds in predictions_per_window.items():
|
49
|
-
if len(preds) != num_val_windows:
|
50
|
-
raise ValueError(f"For model {model} predictions are unavailable for some validation windows")
|
51
|
-
self._fit_ensemble(
|
52
|
-
predictions_per_window=predictions_per_window,
|
53
|
-
data_per_window=data_per_window,
|
54
|
-
time_limit=time_limit,
|
55
|
-
)
|
56
|
-
return self
|
57
|
-
|
58
|
-
def _fit_ensemble(
|
59
|
-
self,
|
60
|
-
predictions_per_window: Dict[str, List[TimeSeriesDataFrame]],
|
61
|
-
data_per_window: List[TimeSeriesDataFrame],
|
62
|
-
time_limit: Optional[int] = None,
|
63
|
-
**kwargs,
|
64
|
-
):
|
65
|
-
"""Private method for `fit_ensemble`. See `fit_ensemble` for documentation of arguments. Apart from the model
|
66
|
-
training logic, `fit_ensemble` additionally implements other logic such as keeping track of the time limit.
|
67
|
-
"""
|
68
|
-
raise NotImplementedError
|
69
|
-
|
70
|
-
def predict(self, data: Dict[str, Optional[TimeSeriesDataFrame]], **kwargs) -> TimeSeriesDataFrame:
|
71
|
-
raise NotImplementedError
|
72
|
-
|
73
|
-
def remap_base_models(self, model_refit_map: Dict[str, str]) -> None:
|
74
|
-
"""Update names of the base models based on the mapping in model_refit_map.
|
75
|
-
|
76
|
-
This method should be called after performing refit_full to point to the refitted base models, if necessary.
|
77
|
-
"""
|
78
|
-
raise NotImplementedError
|
79
|
-
|
80
|
-
# TODO: remove
|
81
|
-
def _fit(*args, **kwargs):
|
82
|
-
pass
|
83
|
-
|
84
|
-
# TODO: remove
|
85
|
-
def _predict(*args, **kwargs):
|
86
|
-
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|