autogluon.timeseries 1.3.2b20250625__tar.gz → 1.3.2b20250626__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.
Files changed (72) hide show
  1. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/PKG-INFO +1 -1
  2. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/pipeline/utils.py +1 -1
  3. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/gluonts/__init__.py +1 -1
  4. autogluon.timeseries-1.3.2b20250625/src/autogluon/timeseries/models/gluonts/abstract_gluonts.py → autogluon.timeseries-1.3.2b20250626/src/autogluon/timeseries/models/gluonts/abstract.py +4 -104
  5. autogluon.timeseries-1.3.2b20250626/src/autogluon/timeseries/models/gluonts/dataset.py +109 -0
  6. {autogluon.timeseries-1.3.2b20250625/src/autogluon/timeseries/models/gluonts/torch → autogluon.timeseries-1.3.2b20250626/src/autogluon/timeseries/models/gluonts}/models.py +2 -1
  7. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/version.py +1 -1
  8. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/PKG-INFO +1 -1
  9. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/SOURCES.txt +3 -3
  10. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/requires.txt +4 -4
  11. autogluon.timeseries-1.3.2b20250625/src/autogluon/timeseries/utils/__init__.py +0 -0
  12. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/setup.cfg +0 -0
  13. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/setup.py +0 -0
  14. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/__init__.py +0 -0
  15. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/configs/__init__.py +0 -0
  16. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/configs/presets_configs.py +0 -0
  17. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/dataset/__init__.py +0 -0
  18. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/dataset/ts_dataframe.py +0 -0
  19. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/evaluator.py +0 -0
  20. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/learner.py +0 -0
  21. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/metrics/__init__.py +0 -0
  22. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/metrics/abstract.py +0 -0
  23. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/metrics/point.py +0 -0
  24. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/metrics/quantile.py +0 -0
  25. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/metrics/utils.py +0 -0
  26. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/__init__.py +0 -0
  27. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/abstract/__init__.py +0 -0
  28. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/abstract/abstract_timeseries_model.py +0 -0
  29. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/abstract/model_trial.py +0 -0
  30. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/abstract/tunable.py +0 -0
  31. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/autogluon_tabular/__init__.py +0 -0
  32. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/autogluon_tabular/mlforecast.py +0 -0
  33. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/autogluon_tabular/transforms.py +0 -0
  34. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/autogluon_tabular/utils.py +0 -0
  35. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/__init__.py +0 -0
  36. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/model.py +0 -0
  37. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/pipeline/__init__.py +0 -0
  38. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/pipeline/base.py +0 -0
  39. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/pipeline/chronos.py +0 -0
  40. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py +0 -0
  41. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/ensemble/__init__.py +0 -0
  42. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/ensemble/abstract.py +0 -0
  43. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/ensemble/basic.py +0 -0
  44. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/ensemble/greedy.py +0 -0
  45. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/local/__init__.py +0 -0
  46. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/local/abstract_local_model.py +0 -0
  47. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/local/naive.py +0 -0
  48. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/local/npts.py +0 -0
  49. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/local/statsforecast.py +0 -0
  50. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/multi_window/__init__.py +0 -0
  51. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/multi_window/multi_window_model.py +0 -0
  52. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/models/presets.py +0 -0
  53. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/predictor.py +0 -0
  54. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/regressor.py +0 -0
  55. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/splitter.py +0 -0
  56. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/trainer.py +0 -0
  57. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/transforms/__init__.py +0 -0
  58. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/transforms/covariate_scaler.py +0 -0
  59. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/transforms/target_scaler.py +0 -0
  60. {autogluon.timeseries-1.3.2b20250625/src/autogluon/timeseries/models/gluonts/torch → autogluon.timeseries-1.3.2b20250626/src/autogluon/timeseries/utils}/__init__.py +0 -0
  61. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/datetime/__init__.py +0 -0
  62. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/datetime/base.py +0 -0
  63. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/datetime/lags.py +0 -0
  64. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/datetime/seasonality.py +0 -0
  65. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/datetime/time_features.py +0 -0
  66. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/features.py +0 -0
  67. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/forecast.py +0 -0
  68. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon/timeseries/utils/warning_filters.py +0 -0
  69. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/dependency_links.txt +0 -0
  70. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/namespace_packages.txt +0 -0
  71. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/top_level.txt +0 -0
  72. {autogluon.timeseries-1.3.2b20250625 → autogluon.timeseries-1.3.2b20250626}/src/autogluon.timeseries.egg-info/zip-safe +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.3.2b20250625
3
+ Version: 1.3.2b20250626
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
@@ -16,7 +16,7 @@ from transformers import TrainerCallback
16
16
  from autogluon.common.loaders.load_s3 import download, list_bucket_prefix_suffix_contains_s3
17
17
  from autogluon.core.utils.exceptions import TimeLimitExceeded
18
18
  from autogluon.timeseries.dataset.ts_dataframe import TimeSeriesDataFrame
19
- from autogluon.timeseries.models.gluonts.abstract_gluonts import SimpleGluonTSDataset
19
+ from autogluon.timeseries.models.gluonts.dataset import SimpleGluonTSDataset
20
20
 
21
21
  if TYPE_CHECKING:
22
22
  # TODO: fix the underlying reason for this circular import, the pipeline should handle tokenization
@@ -1,4 +1,4 @@
1
- from .torch.models import (
1
+ from .models import (
2
2
  DeepARModel,
3
3
  DLinearModel,
4
4
  PatchTSTModel,
@@ -3,7 +3,7 @@ import os
3
3
  import shutil
4
4
  from datetime import timedelta
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Type, Union, cast, overload
6
+ from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Type, Union, cast, overload
7
7
 
8
8
  import gluonts
9
9
  import gluonts.core.settings
@@ -11,7 +11,6 @@ import numpy as np
11
11
  import pandas as pd
12
12
  from gluonts.core.component import from_hyperparameters
13
13
  from gluonts.dataset.common import Dataset as GluonTSDataset
14
- from gluonts.dataset.field_names import FieldName
15
14
  from gluonts.env import env as gluonts_env
16
15
  from gluonts.model.estimator import Estimator as GluonTSEstimator
17
16
  from gluonts.model.forecast import Forecast, QuantileForecast, SampleForecast
@@ -22,14 +21,15 @@ from autogluon.core.hpo.constants import RAY_BACKEND
22
21
  from autogluon.tabular.models.tabular_nn.utils.categorical_encoders import (
23
22
  OneHotMergeRaresHandleUnknownEncoder as OneHotEncoder,
24
23
  )
25
- from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TIMESTAMP, TimeSeriesDataFrame
24
+ from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TimeSeriesDataFrame
26
25
  from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
27
- from autogluon.timeseries.utils.datetime import norm_freq_str
28
26
  from autogluon.timeseries.utils.warning_filters import disable_root_logger, warning_filter
29
27
 
30
28
  if TYPE_CHECKING:
31
29
  from gluonts.torch.model.forecast import DistributionForecast
32
30
 
31
+ from .dataset import SimpleGluonTSDataset
32
+
33
33
  # NOTE: We avoid imports for torch and lightning.pytorch at the top level and hide them inside class methods.
34
34
  # This is done to skip these imports during multiprocessing (which may cause bugs)
35
35
 
@@ -37,106 +37,6 @@ logger = logging.getLogger(__name__)
37
37
  gts_logger = logging.getLogger(gluonts.__name__)
38
38
 
39
39
 
40
- class SimpleGluonTSDataset(GluonTSDataset):
41
- """Wrapper for TimeSeriesDataFrame that is compatible with the GluonTS Dataset API."""
42
-
43
- def __init__(
44
- self,
45
- target_df: TimeSeriesDataFrame,
46
- freq: str,
47
- target_column: str = "target",
48
- feat_static_cat: Optional[np.ndarray] = None,
49
- feat_static_real: Optional[np.ndarray] = None,
50
- feat_dynamic_cat: Optional[np.ndarray] = None,
51
- feat_dynamic_real: Optional[np.ndarray] = None,
52
- past_feat_dynamic_cat: Optional[np.ndarray] = None,
53
- past_feat_dynamic_real: Optional[np.ndarray] = None,
54
- includes_future: bool = False,
55
- prediction_length: Optional[int] = None,
56
- ):
57
- assert target_df is not None
58
- # Convert TimeSeriesDataFrame to pd.Series for faster processing
59
- self.target_array = target_df[target_column].to_numpy(np.float32)
60
- self.feat_static_cat = self._astype(feat_static_cat, dtype=np.int64)
61
- self.feat_static_real = self._astype(feat_static_real, dtype=np.float32)
62
- self.feat_dynamic_cat = self._astype(feat_dynamic_cat, dtype=np.int64)
63
- self.feat_dynamic_real = self._astype(feat_dynamic_real, dtype=np.float32)
64
- self.past_feat_dynamic_cat = self._astype(past_feat_dynamic_cat, dtype=np.int64)
65
- self.past_feat_dynamic_real = self._astype(past_feat_dynamic_real, dtype=np.float32)
66
- self.freq = self._get_freq_for_period(freq)
67
-
68
- # Necessary to compute indptr for known_covariates at prediction time
69
- self.includes_future = includes_future
70
- self.prediction_length = prediction_length
71
-
72
- # Replace inefficient groupby ITEMID with indptr that stores start:end of each time series
73
- self.item_ids = target_df.item_ids
74
- self.indptr = target_df.get_indptr()
75
- self.start_timestamps = target_df.index[self.indptr[:-1]].to_frame(index=False)[TIMESTAMP]
76
- assert len(self.item_ids) == len(self.start_timestamps)
77
-
78
- @staticmethod
79
- def _astype(array: Optional[np.ndarray], dtype: Type[np.generic]) -> Optional[np.ndarray]:
80
- if array is None:
81
- return None
82
- else:
83
- return array.astype(dtype)
84
-
85
- @staticmethod
86
- def _get_freq_for_period(freq: str) -> str:
87
- """Convert freq to format compatible with pd.Period.
88
-
89
- For example, ME freq must be converted to M when creating a pd.Period.
90
- """
91
- offset = pd.tseries.frequencies.to_offset(freq)
92
- assert offset is not None
93
- freq_name = norm_freq_str(offset)
94
- if freq_name == "SME":
95
- # Replace unsupported frequency "SME" with "2W"
96
- return "2W"
97
- elif freq_name == "bh":
98
- # Replace unsupported frequency "bh" with dummy value "Y"
99
- return "Y"
100
- else:
101
- freq_name_for_period = {"YE": "Y", "QE": "Q", "ME": "M"}.get(freq_name, freq_name)
102
- return f"{offset.n}{freq_name_for_period}"
103
-
104
- def __len__(self):
105
- return len(self.indptr) - 1 # noqa
106
-
107
- def __iter__(self) -> Iterator[Dict[str, Any]]:
108
- for j in range(len(self.indptr) - 1):
109
- start_idx = self.indptr[j]
110
- end_idx = self.indptr[j + 1]
111
- # GluonTS expects item_id to be a string
112
- ts = {
113
- FieldName.ITEM_ID: str(self.item_ids[j]),
114
- FieldName.START: pd.Period(self.start_timestamps.iloc[j], freq=self.freq),
115
- FieldName.TARGET: self.target_array[start_idx:end_idx],
116
- }
117
- if self.feat_static_cat is not None:
118
- ts[FieldName.FEAT_STATIC_CAT] = self.feat_static_cat[j]
119
- if self.feat_static_real is not None:
120
- ts[FieldName.FEAT_STATIC_REAL] = self.feat_static_real[j]
121
- if self.past_feat_dynamic_cat is not None:
122
- ts[FieldName.PAST_FEAT_DYNAMIC_CAT] = self.past_feat_dynamic_cat[start_idx:end_idx].T
123
- if self.past_feat_dynamic_real is not None:
124
- ts[FieldName.PAST_FEAT_DYNAMIC_REAL] = self.past_feat_dynamic_real[start_idx:end_idx].T
125
-
126
- # Dynamic features that may extend into the future
127
- if self.includes_future:
128
- assert self.prediction_length is not None, (
129
- "Prediction length must be provided if includes_future is True"
130
- )
131
- start_idx = start_idx + j * self.prediction_length
132
- end_idx = end_idx + (j + 1) * self.prediction_length
133
- if self.feat_dynamic_cat is not None:
134
- ts[FieldName.FEAT_DYNAMIC_CAT] = self.feat_dynamic_cat[start_idx:end_idx].T
135
- if self.feat_dynamic_real is not None:
136
- ts[FieldName.FEAT_DYNAMIC_REAL] = self.feat_dynamic_real[start_idx:end_idx].T
137
- yield ts
138
-
139
-
140
40
  class AbstractGluonTSModel(AbstractTimeSeriesModel):
141
41
  """Abstract class wrapping GluonTS estimators for use in autogluon.timeseries.
142
42
 
@@ -0,0 +1,109 @@
1
+ from typing import Any, Dict, Iterator, Optional, Type
2
+
3
+ import numpy as np
4
+ import pandas as pd
5
+ from gluonts.dataset.common import Dataset as GluonTSDataset
6
+ from gluonts.dataset.field_names import FieldName
7
+
8
+ from autogluon.timeseries.dataset.ts_dataframe import TIMESTAMP, TimeSeriesDataFrame
9
+ from autogluon.timeseries.utils.datetime import norm_freq_str
10
+
11
+
12
+ class SimpleGluonTSDataset(GluonTSDataset):
13
+ """Wrapper for TimeSeriesDataFrame that is compatible with the GluonTS Dataset API."""
14
+
15
+ def __init__(
16
+ self,
17
+ target_df: TimeSeriesDataFrame,
18
+ freq: str,
19
+ target_column: str = "target",
20
+ feat_static_cat: Optional[np.ndarray] = None,
21
+ feat_static_real: Optional[np.ndarray] = None,
22
+ feat_dynamic_cat: Optional[np.ndarray] = None,
23
+ feat_dynamic_real: Optional[np.ndarray] = None,
24
+ past_feat_dynamic_cat: Optional[np.ndarray] = None,
25
+ past_feat_dynamic_real: Optional[np.ndarray] = None,
26
+ includes_future: bool = False,
27
+ prediction_length: Optional[int] = None,
28
+ ):
29
+ assert target_df is not None
30
+ # Convert TimeSeriesDataFrame to pd.Series for faster processing
31
+ self.target_array = target_df[target_column].to_numpy(np.float32)
32
+ self.feat_static_cat = self._astype(feat_static_cat, dtype=np.int64)
33
+ self.feat_static_real = self._astype(feat_static_real, dtype=np.float32)
34
+ self.feat_dynamic_cat = self._astype(feat_dynamic_cat, dtype=np.int64)
35
+ self.feat_dynamic_real = self._astype(feat_dynamic_real, dtype=np.float32)
36
+ self.past_feat_dynamic_cat = self._astype(past_feat_dynamic_cat, dtype=np.int64)
37
+ self.past_feat_dynamic_real = self._astype(past_feat_dynamic_real, dtype=np.float32)
38
+ self.freq = self._get_freq_for_period(freq)
39
+
40
+ # Necessary to compute indptr for known_covariates at prediction time
41
+ self.includes_future = includes_future
42
+ self.prediction_length = prediction_length
43
+
44
+ # Replace inefficient groupby ITEMID with indptr that stores start:end of each time series
45
+ self.item_ids = target_df.item_ids
46
+ self.indptr = target_df.get_indptr()
47
+ self.start_timestamps = target_df.index[self.indptr[:-1]].to_frame(index=False)[TIMESTAMP]
48
+ assert len(self.item_ids) == len(self.start_timestamps)
49
+
50
+ @staticmethod
51
+ def _astype(array: Optional[np.ndarray], dtype: Type[np.generic]) -> Optional[np.ndarray]:
52
+ if array is None:
53
+ return None
54
+ else:
55
+ return array.astype(dtype)
56
+
57
+ @staticmethod
58
+ def _get_freq_for_period(freq: str) -> str:
59
+ """Convert freq to format compatible with pd.Period.
60
+
61
+ For example, ME freq must be converted to M when creating a pd.Period.
62
+ """
63
+ offset = pd.tseries.frequencies.to_offset(freq)
64
+ assert offset is not None
65
+ freq_name = norm_freq_str(offset)
66
+ if freq_name == "SME":
67
+ # Replace unsupported frequency "SME" with "2W"
68
+ return "2W"
69
+ elif freq_name == "bh":
70
+ # Replace unsupported frequency "bh" with dummy value "Y"
71
+ return "Y"
72
+ else:
73
+ freq_name_for_period = {"YE": "Y", "QE": "Q", "ME": "M"}.get(freq_name, freq_name)
74
+ return f"{offset.n}{freq_name_for_period}"
75
+
76
+ def __len__(self):
77
+ return len(self.indptr) - 1 # noqa
78
+
79
+ def __iter__(self) -> Iterator[Dict[str, Any]]:
80
+ for j in range(len(self.indptr) - 1):
81
+ start_idx = self.indptr[j]
82
+ end_idx = self.indptr[j + 1]
83
+ # GluonTS expects item_id to be a string
84
+ ts = {
85
+ FieldName.ITEM_ID: str(self.item_ids[j]),
86
+ FieldName.START: pd.Period(self.start_timestamps.iloc[j], freq=self.freq),
87
+ FieldName.TARGET: self.target_array[start_idx:end_idx],
88
+ }
89
+ if self.feat_static_cat is not None:
90
+ ts[FieldName.FEAT_STATIC_CAT] = self.feat_static_cat[j]
91
+ if self.feat_static_real is not None:
92
+ ts[FieldName.FEAT_STATIC_REAL] = self.feat_static_real[j]
93
+ if self.past_feat_dynamic_cat is not None:
94
+ ts[FieldName.PAST_FEAT_DYNAMIC_CAT] = self.past_feat_dynamic_cat[start_idx:end_idx].T
95
+ if self.past_feat_dynamic_real is not None:
96
+ ts[FieldName.PAST_FEAT_DYNAMIC_REAL] = self.past_feat_dynamic_real[start_idx:end_idx].T
97
+
98
+ # Dynamic features that may extend into the future
99
+ if self.includes_future:
100
+ assert self.prediction_length is not None, (
101
+ "Prediction length must be provided if includes_future is True"
102
+ )
103
+ start_idx = start_idx + j * self.prediction_length
104
+ end_idx = end_idx + (j + 1) * self.prediction_length
105
+ if self.feat_dynamic_cat is not None:
106
+ ts[FieldName.FEAT_DYNAMIC_CAT] = self.feat_dynamic_cat[start_idx:end_idx].T
107
+ if self.feat_dynamic_real is not None:
108
+ ts[FieldName.FEAT_DYNAMIC_REAL] = self.feat_dynamic_real[start_idx:end_idx].T
109
+ yield ts
@@ -7,13 +7,14 @@ from typing import Any, Dict, Type
7
7
 
8
8
  from gluonts.model.estimator import Estimator as GluonTSEstimator
9
9
 
10
- from autogluon.timeseries.models.gluonts.abstract_gluonts import AbstractGluonTSModel
11
10
  from autogluon.timeseries.utils.datetime import (
12
11
  get_lags_for_frequency,
13
12
  get_seasonality,
14
13
  get_time_features_for_frequency,
15
14
  )
16
15
 
16
+ from .abstract import AbstractGluonTSModel
17
+
17
18
  # NOTE: We avoid imports for torch and lightning.pytorch at the top level and hide them inside class methods.
18
19
  # This is done to skip these imports during multiprocessing (which may cause bugs)
19
20
 
@@ -1,4 +1,4 @@
1
1
  """This is the autogluon version file."""
2
2
 
3
- __version__ = "1.3.2b20250625"
3
+ __version__ = "1.3.2b20250626"
4
4
  __lite__ = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.3.2b20250625
3
+ Version: 1.3.2b20250626
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
@@ -47,9 +47,9 @@ src/autogluon/timeseries/models/ensemble/abstract.py
47
47
  src/autogluon/timeseries/models/ensemble/basic.py
48
48
  src/autogluon/timeseries/models/ensemble/greedy.py
49
49
  src/autogluon/timeseries/models/gluonts/__init__.py
50
- src/autogluon/timeseries/models/gluonts/abstract_gluonts.py
51
- src/autogluon/timeseries/models/gluonts/torch/__init__.py
52
- src/autogluon/timeseries/models/gluonts/torch/models.py
50
+ src/autogluon/timeseries/models/gluonts/abstract.py
51
+ src/autogluon/timeseries/models/gluonts/dataset.py
52
+ src/autogluon/timeseries/models/gluonts/models.py
53
53
  src/autogluon/timeseries/models/local/__init__.py
54
54
  src/autogluon/timeseries/models/local/abstract_local_model.py
55
55
  src/autogluon/timeseries/models/local/naive.py
@@ -17,10 +17,10 @@ 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.3.2b20250625
21
- autogluon.common==1.3.2b20250625
22
- autogluon.features==1.3.2b20250625
23
- autogluon.tabular[catboost,lightgbm,xgboost]==1.3.2b20250625
20
+ autogluon.core[raytune]==1.3.2b20250626
21
+ autogluon.common==1.3.2b20250626
22
+ autogluon.features==1.3.2b20250626
23
+ autogluon.tabular[catboost,lightgbm,xgboost]==1.3.2b20250626
24
24
 
25
25
  [all]
26
26