autogluon.timeseries 1.0.1b20240304__py3-none-any.whl → 1.4.1b20251210__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.
- autogluon/timeseries/configs/__init__.py +3 -2
- autogluon/timeseries/configs/hyperparameter_presets.py +62 -0
- autogluon/timeseries/configs/predictor_presets.py +84 -0
- autogluon/timeseries/dataset/ts_dataframe.py +339 -186
- autogluon/timeseries/learner.py +192 -60
- autogluon/timeseries/metrics/__init__.py +55 -11
- autogluon/timeseries/metrics/abstract.py +96 -25
- autogluon/timeseries/metrics/point.py +186 -39
- autogluon/timeseries/metrics/quantile.py +47 -20
- autogluon/timeseries/metrics/utils.py +6 -6
- autogluon/timeseries/models/__init__.py +13 -7
- autogluon/timeseries/models/abstract/__init__.py +2 -2
- autogluon/timeseries/models/abstract/abstract_timeseries_model.py +533 -273
- autogluon/timeseries/models/abstract/model_trial.py +10 -10
- autogluon/timeseries/models/abstract/tunable.py +189 -0
- autogluon/timeseries/models/autogluon_tabular/__init__.py +2 -0
- autogluon/timeseries/models/autogluon_tabular/mlforecast.py +369 -215
- autogluon/timeseries/models/autogluon_tabular/per_step.py +513 -0
- autogluon/timeseries/models/autogluon_tabular/transforms.py +67 -0
- autogluon/timeseries/models/autogluon_tabular/utils.py +3 -51
- autogluon/timeseries/models/chronos/__init__.py +4 -0
- autogluon/timeseries/models/chronos/chronos2.py +361 -0
- autogluon/timeseries/models/chronos/model.py +738 -0
- autogluon/timeseries/models/chronos/utils.py +369 -0
- autogluon/timeseries/models/ensemble/__init__.py +35 -2
- autogluon/timeseries/models/ensemble/{abstract_timeseries_ensemble.py → abstract.py} +50 -26
- autogluon/timeseries/models/ensemble/array_based/__init__.py +3 -0
- autogluon/timeseries/models/ensemble/array_based/abstract.py +236 -0
- autogluon/timeseries/models/ensemble/array_based/models.py +73 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/__init__.py +12 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/abstract.py +88 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/linear_stacker.py +167 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/per_quantile_tabular.py +94 -0
- autogluon/timeseries/models/ensemble/array_based/regressor/tabular.py +107 -0
- autogluon/timeseries/models/ensemble/ensemble_selection.py +167 -0
- autogluon/timeseries/models/ensemble/per_item_greedy.py +162 -0
- autogluon/timeseries/models/ensemble/weighted/__init__.py +8 -0
- autogluon/timeseries/models/ensemble/weighted/abstract.py +40 -0
- autogluon/timeseries/models/ensemble/weighted/basic.py +78 -0
- autogluon/timeseries/models/ensemble/weighted/greedy.py +57 -0
- autogluon/timeseries/models/gluonts/__init__.py +3 -1
- autogluon/timeseries/models/gluonts/abstract.py +583 -0
- autogluon/timeseries/models/gluonts/dataset.py +109 -0
- autogluon/timeseries/models/gluonts/{torch/models.py → models.py} +185 -44
- autogluon/timeseries/models/local/__init__.py +1 -10
- autogluon/timeseries/models/local/abstract_local_model.py +150 -97
- autogluon/timeseries/models/local/naive.py +31 -23
- autogluon/timeseries/models/local/npts.py +6 -2
- autogluon/timeseries/models/local/statsforecast.py +99 -112
- autogluon/timeseries/models/multi_window/multi_window_model.py +99 -40
- autogluon/timeseries/models/registry.py +64 -0
- autogluon/timeseries/models/toto/__init__.py +3 -0
- autogluon/timeseries/models/toto/_internal/__init__.py +9 -0
- autogluon/timeseries/models/toto/_internal/backbone/__init__.py +3 -0
- autogluon/timeseries/models/toto/_internal/backbone/attention.py +196 -0
- autogluon/timeseries/models/toto/_internal/backbone/backbone.py +262 -0
- autogluon/timeseries/models/toto/_internal/backbone/distribution.py +70 -0
- autogluon/timeseries/models/toto/_internal/backbone/kvcache.py +136 -0
- autogluon/timeseries/models/toto/_internal/backbone/rope.py +89 -0
- autogluon/timeseries/models/toto/_internal/backbone/rotary_embedding_torch.py +342 -0
- autogluon/timeseries/models/toto/_internal/backbone/scaler.py +305 -0
- autogluon/timeseries/models/toto/_internal/backbone/transformer.py +333 -0
- autogluon/timeseries/models/toto/_internal/dataset.py +165 -0
- autogluon/timeseries/models/toto/_internal/forecaster.py +423 -0
- autogluon/timeseries/models/toto/dataloader.py +108 -0
- autogluon/timeseries/models/toto/hf_pretrained_model.py +118 -0
- autogluon/timeseries/models/toto/model.py +236 -0
- autogluon/timeseries/predictor.py +826 -305
- autogluon/timeseries/regressor.py +253 -0
- autogluon/timeseries/splitter.py +10 -31
- autogluon/timeseries/trainer/__init__.py +2 -3
- autogluon/timeseries/trainer/ensemble_composer.py +439 -0
- autogluon/timeseries/trainer/model_set_builder.py +256 -0
- autogluon/timeseries/trainer/prediction_cache.py +149 -0
- autogluon/timeseries/trainer/trainer.py +1298 -0
- autogluon/timeseries/trainer/utils.py +17 -0
- autogluon/timeseries/transforms/__init__.py +2 -0
- autogluon/timeseries/transforms/covariate_scaler.py +164 -0
- autogluon/timeseries/transforms/target_scaler.py +149 -0
- autogluon/timeseries/utils/constants.py +10 -0
- autogluon/timeseries/utils/datetime/base.py +38 -20
- autogluon/timeseries/utils/datetime/lags.py +18 -16
- autogluon/timeseries/utils/datetime/seasonality.py +14 -14
- autogluon/timeseries/utils/datetime/time_features.py +17 -14
- autogluon/timeseries/utils/features.py +317 -53
- autogluon/timeseries/utils/forecast.py +31 -17
- autogluon/timeseries/utils/timer.py +173 -0
- autogluon/timeseries/utils/warning_filters.py +44 -6
- autogluon/timeseries/version.py +2 -1
- autogluon.timeseries-1.4.1b20251210-py3.11-nspkg.pth +1 -0
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info}/METADATA +71 -47
- autogluon_timeseries-1.4.1b20251210.dist-info/RECORD +103 -0
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info}/WHEEL +1 -1
- autogluon/timeseries/configs/presets_configs.py +0 -11
- autogluon/timeseries/evaluator.py +0 -6
- autogluon/timeseries/models/ensemble/greedy_ensemble.py +0 -170
- autogluon/timeseries/models/gluonts/abstract_gluonts.py +0 -550
- autogluon/timeseries/models/gluonts/torch/__init__.py +0 -0
- autogluon/timeseries/models/presets.py +0 -325
- autogluon/timeseries/trainer/abstract_trainer.py +0 -1144
- autogluon/timeseries/trainer/auto_trainer.py +0 -74
- autogluon.timeseries-1.0.1b20240304-py3.8-nspkg.pth +0 -1
- autogluon.timeseries-1.0.1b20240304.dist-info/RECORD +0 -58
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info/licenses}/LICENSE +0 -0
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info/licenses}/NOTICE +0 -0
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info}/namespace_packages.txt +0 -0
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info}/top_level.txt +0 -0
- {autogluon.timeseries-1.0.1b20240304.dist-info → autogluon_timeseries-1.4.1b20251210.dist-info}/zip-safe +0 -0
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import copy
|
|
2
|
-
import logging
|
|
3
|
-
import re
|
|
4
|
-
from collections import defaultdict
|
|
5
|
-
from typing import Any, Dict, List, Optional, Type, Union
|
|
6
|
-
|
|
7
|
-
from autogluon.common import space
|
|
8
|
-
from autogluon.core import constants
|
|
9
|
-
from autogluon.timeseries.metrics import TimeSeriesScorer
|
|
10
|
-
|
|
11
|
-
from . import (
|
|
12
|
-
ADIDAModel,
|
|
13
|
-
AutoARIMAModel,
|
|
14
|
-
AutoCESModel,
|
|
15
|
-
AutoETSModel,
|
|
16
|
-
AverageModel,
|
|
17
|
-
CrostonSBAModel,
|
|
18
|
-
DeepARModel,
|
|
19
|
-
DirectTabularModel,
|
|
20
|
-
DLinearModel,
|
|
21
|
-
DynamicOptimizedThetaModel,
|
|
22
|
-
ETSModel,
|
|
23
|
-
IMAPAModel,
|
|
24
|
-
NaiveModel,
|
|
25
|
-
NPTSModel,
|
|
26
|
-
PatchTSTModel,
|
|
27
|
-
RecursiveTabularModel,
|
|
28
|
-
SeasonalAverageModel,
|
|
29
|
-
SeasonalNaiveModel,
|
|
30
|
-
SimpleFeedForwardModel,
|
|
31
|
-
TemporalFusionTransformerModel,
|
|
32
|
-
ThetaModel,
|
|
33
|
-
WaveNetModel,
|
|
34
|
-
ZeroModel,
|
|
35
|
-
)
|
|
36
|
-
from .abstract import AbstractTimeSeriesModel
|
|
37
|
-
from .multi_window.multi_window_model import MultiWindowBacktestingModel
|
|
38
|
-
|
|
39
|
-
# TODO: Enable ARIMAModel after upgrading to StatsForecast >=1.5.0 - currently ARIMA model is broken
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
logger = logging.getLogger(__name__)
|
|
43
|
-
|
|
44
|
-
ModelHyperparameters = Dict[str, Any]
|
|
45
|
-
|
|
46
|
-
# define the model zoo with their aliases
|
|
47
|
-
MODEL_TYPES = dict(
|
|
48
|
-
SimpleFeedForward=SimpleFeedForwardModel,
|
|
49
|
-
DeepAR=DeepARModel,
|
|
50
|
-
DLinear=DLinearModel,
|
|
51
|
-
PatchTST=PatchTSTModel,
|
|
52
|
-
TemporalFusionTransformer=TemporalFusionTransformerModel,
|
|
53
|
-
WaveNet=WaveNetModel,
|
|
54
|
-
RecursiveTabular=RecursiveTabularModel,
|
|
55
|
-
DirectTabular=DirectTabularModel,
|
|
56
|
-
Average=AverageModel,
|
|
57
|
-
SeasonalAverage=SeasonalAverageModel,
|
|
58
|
-
Naive=NaiveModel,
|
|
59
|
-
SeasonalNaive=SeasonalNaiveModel,
|
|
60
|
-
Zero=ZeroModel,
|
|
61
|
-
AutoETS=AutoETSModel,
|
|
62
|
-
AutoCES=AutoCESModel,
|
|
63
|
-
AutoARIMA=AutoARIMAModel,
|
|
64
|
-
DynamicOptimizedTheta=DynamicOptimizedThetaModel,
|
|
65
|
-
NPTS=NPTSModel,
|
|
66
|
-
Theta=ThetaModel,
|
|
67
|
-
ETS=ETSModel,
|
|
68
|
-
ADIDA=ADIDAModel,
|
|
69
|
-
CrostonSBA=CrostonSBAModel,
|
|
70
|
-
IMAPA=IMAPAModel,
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
DEFAULT_MODEL_NAMES = {v: k for k, v in MODEL_TYPES.items()}
|
|
74
|
-
DEFAULT_MODEL_PRIORITY = dict(
|
|
75
|
-
Naive=100,
|
|
76
|
-
SeasonalNaive=100,
|
|
77
|
-
Average=100,
|
|
78
|
-
SeasonalAverage=100,
|
|
79
|
-
Zero=100,
|
|
80
|
-
NPTS=90,
|
|
81
|
-
ETS=90,
|
|
82
|
-
CrostonSBA=90,
|
|
83
|
-
Theta=80,
|
|
84
|
-
DynamicOptimizedTheta=80,
|
|
85
|
-
AutoETS=80,
|
|
86
|
-
AutoARIMA=70,
|
|
87
|
-
RecursiveTabular=60,
|
|
88
|
-
DirectTabular=50,
|
|
89
|
-
DeepAR=40,
|
|
90
|
-
TemporalFusionTransformer=30,
|
|
91
|
-
WaveNet=25,
|
|
92
|
-
PatchTST=20,
|
|
93
|
-
# Models below are not included in any presets
|
|
94
|
-
AutoCES=10,
|
|
95
|
-
ARIMA=10,
|
|
96
|
-
ADIDA=10,
|
|
97
|
-
IMAPA=10,
|
|
98
|
-
SimpleFeedForward=10,
|
|
99
|
-
)
|
|
100
|
-
DEFAULT_CUSTOM_MODEL_PRIORITY = 0
|
|
101
|
-
|
|
102
|
-
VALID_AG_ARGS_KEYS = {
|
|
103
|
-
"name",
|
|
104
|
-
"name_prefix",
|
|
105
|
-
"name_suffix",
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def get_default_hps(key):
|
|
110
|
-
default_model_hps = {
|
|
111
|
-
"very_light": {
|
|
112
|
-
"Naive": {},
|
|
113
|
-
"SeasonalNaive": {},
|
|
114
|
-
"ETS": {},
|
|
115
|
-
"Theta": {},
|
|
116
|
-
"RecursiveTabular": {"max_num_samples": 100_000},
|
|
117
|
-
"DirectTabular": {"max_num_samples": 100_000},
|
|
118
|
-
},
|
|
119
|
-
"light": {
|
|
120
|
-
"Naive": {},
|
|
121
|
-
"SeasonalNaive": {},
|
|
122
|
-
"ETS": {},
|
|
123
|
-
"Theta": {},
|
|
124
|
-
"RecursiveTabular": {},
|
|
125
|
-
"DirectTabular": {},
|
|
126
|
-
"TemporalFusionTransformer": {},
|
|
127
|
-
},
|
|
128
|
-
"default": {
|
|
129
|
-
"SeasonalNaive": {},
|
|
130
|
-
"CrostonSBA": {},
|
|
131
|
-
"AutoETS": {},
|
|
132
|
-
"AutoARIMA": {},
|
|
133
|
-
"NPTS": {},
|
|
134
|
-
"DynamicOptimizedTheta": {},
|
|
135
|
-
# TODO: Define separate model for each tabular submodel?
|
|
136
|
-
"RecursiveTabular": {
|
|
137
|
-
"tabular_hyperparameters": {"NN_TORCH": {"proc.impute_strategy": "constant"}, "GBM": {}},
|
|
138
|
-
},
|
|
139
|
-
"DirectTabular": {},
|
|
140
|
-
"TemporalFusionTransformer": {},
|
|
141
|
-
"PatchTST": {},
|
|
142
|
-
"DeepAR": {},
|
|
143
|
-
},
|
|
144
|
-
}
|
|
145
|
-
return default_model_hps[key]
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
def get_preset_models(
|
|
149
|
-
freq: str,
|
|
150
|
-
prediction_length: int,
|
|
151
|
-
path: str,
|
|
152
|
-
eval_metric: TimeSeriesScorer,
|
|
153
|
-
eval_metric_seasonal_period: Optional[int],
|
|
154
|
-
hyperparameters: Union[str, Dict, None],
|
|
155
|
-
hyperparameter_tune: bool,
|
|
156
|
-
all_assigned_names: List[str],
|
|
157
|
-
excluded_model_types: List[str],
|
|
158
|
-
multi_window: bool = False,
|
|
159
|
-
**kwargs,
|
|
160
|
-
):
|
|
161
|
-
"""
|
|
162
|
-
Create a list of models according to hyperparameters. If hyperparamaters=None,
|
|
163
|
-
will create models according to presets.
|
|
164
|
-
"""
|
|
165
|
-
models = []
|
|
166
|
-
if hyperparameters is None:
|
|
167
|
-
hp_string = "default"
|
|
168
|
-
hyperparameters = copy.deepcopy(get_default_hps(hp_string))
|
|
169
|
-
elif isinstance(hyperparameters, str):
|
|
170
|
-
hyperparameters = copy.deepcopy(get_default_hps(hyperparameters))
|
|
171
|
-
elif isinstance(hyperparameters, dict):
|
|
172
|
-
hyperparameters = copy.deepcopy(hyperparameters)
|
|
173
|
-
else:
|
|
174
|
-
raise ValueError(
|
|
175
|
-
f"hyperparameters must be a dict, a string or None (received {type(hyperparameters)}). "
|
|
176
|
-
f"Please see the documentation for TimeSeriesPredictor.fit"
|
|
177
|
-
)
|
|
178
|
-
hyperparameters = check_and_clean_hyperparameters(hyperparameters, must_contain_searchspace=hyperparameter_tune)
|
|
179
|
-
|
|
180
|
-
excluded_models = set()
|
|
181
|
-
if excluded_model_types is not None and len(excluded_model_types) > 0:
|
|
182
|
-
if not isinstance(excluded_model_types, list):
|
|
183
|
-
raise ValueError(f"`excluded_model_types` must be a list, received {type(excluded_model_types)}")
|
|
184
|
-
logger.info(f"Excluded model types: {excluded_model_types}")
|
|
185
|
-
for model in excluded_model_types:
|
|
186
|
-
if not isinstance(model, str):
|
|
187
|
-
raise ValueError(f"Each entry in `excluded_model_types` must be a string, received {type(model)}")
|
|
188
|
-
excluded_models.add(normalize_model_type_name(model))
|
|
189
|
-
|
|
190
|
-
all_assigned_names = set(all_assigned_names)
|
|
191
|
-
|
|
192
|
-
model_priority_list = sorted(hyperparameters.keys(), key=lambda x: DEFAULT_MODEL_PRIORITY.get(x, 0), reverse=True)
|
|
193
|
-
|
|
194
|
-
for model in model_priority_list:
|
|
195
|
-
if isinstance(model, str):
|
|
196
|
-
if model not in MODEL_TYPES:
|
|
197
|
-
raise ValueError(f"Model {model} is not supported yet.")
|
|
198
|
-
if model in excluded_models:
|
|
199
|
-
logger.info(
|
|
200
|
-
f"\tFound '{model}' model in `hyperparameters`, but '{model}' "
|
|
201
|
-
"is present in `excluded_model_types` and will be removed."
|
|
202
|
-
)
|
|
203
|
-
continue
|
|
204
|
-
if "mxnet" in model.lower():
|
|
205
|
-
logger.info(f"\tMXNet model '{model}' given in `hyperparameters` is deprecated and won't be trained. ")
|
|
206
|
-
continue
|
|
207
|
-
model_type = MODEL_TYPES[model]
|
|
208
|
-
elif isinstance(model, type):
|
|
209
|
-
if not issubclass(model, AbstractTimeSeriesModel):
|
|
210
|
-
raise ValueError(f"Custom model type {model} must inherit from `AbstractTimeSeriesModel`.")
|
|
211
|
-
model_type = model
|
|
212
|
-
else:
|
|
213
|
-
raise ValueError(
|
|
214
|
-
f"Keys of the `hyperparameters` dictionary must be strings or types, received {type(model)}."
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
for model_hps in hyperparameters[model]:
|
|
218
|
-
ag_args = model_hps.pop(constants.AG_ARGS, {})
|
|
219
|
-
for key in ag_args:
|
|
220
|
-
if key not in VALID_AG_ARGS_KEYS:
|
|
221
|
-
raise ValueError(
|
|
222
|
-
f"Model {model_type} received unknown ag_args key: {key} (valid keys {VALID_AG_ARGS_KEYS})"
|
|
223
|
-
)
|
|
224
|
-
model_name_base = get_model_name(ag_args, model_type)
|
|
225
|
-
|
|
226
|
-
model_type_kwargs = dict(
|
|
227
|
-
name=model_name_base,
|
|
228
|
-
path=path,
|
|
229
|
-
freq=freq,
|
|
230
|
-
prediction_length=prediction_length,
|
|
231
|
-
eval_metric=eval_metric,
|
|
232
|
-
eval_metric_seasonal_period=eval_metric_seasonal_period,
|
|
233
|
-
hyperparameters=model_hps,
|
|
234
|
-
**kwargs,
|
|
235
|
-
)
|
|
236
|
-
|
|
237
|
-
# add models while preventing name collisions
|
|
238
|
-
model = model_type(**model_type_kwargs)
|
|
239
|
-
|
|
240
|
-
model_type_kwargs.pop("name", None)
|
|
241
|
-
increment = 1
|
|
242
|
-
while model.name in all_assigned_names:
|
|
243
|
-
increment += 1
|
|
244
|
-
model = model_type(name=f"{model_name_base}_{increment}", **model_type_kwargs)
|
|
245
|
-
|
|
246
|
-
if multi_window:
|
|
247
|
-
model = MultiWindowBacktestingModel(model_base=model, name=model.name, **model_type_kwargs)
|
|
248
|
-
|
|
249
|
-
all_assigned_names.add(model.name)
|
|
250
|
-
models.append(model)
|
|
251
|
-
|
|
252
|
-
return models
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
def normalize_model_type_name(model_name: str) -> str:
|
|
256
|
-
"""Remove 'Model' suffix from the end of the string, if it's present."""
|
|
257
|
-
if model_name.endswith("Model"):
|
|
258
|
-
model_name = model_name[: -len("Model")]
|
|
259
|
-
return model_name
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
def check_and_clean_hyperparameters(
|
|
263
|
-
hyperparameters: Dict[str, Union[ModelHyperparameters, List[ModelHyperparameters]]],
|
|
264
|
-
must_contain_searchspace: bool,
|
|
265
|
-
) -> Dict[str, List[ModelHyperparameters]]:
|
|
266
|
-
"""Convert the hyperparameters dictionary to a unified format:
|
|
267
|
-
- Remove 'Model' suffix from model names, if present
|
|
268
|
-
- Make sure that each value in the hyperparameters dict is a list with model configurations
|
|
269
|
-
- Checks if hyperparameters contain searchspaces
|
|
270
|
-
"""
|
|
271
|
-
hyperparameters_clean = defaultdict(list)
|
|
272
|
-
for key, value in hyperparameters.items():
|
|
273
|
-
# Handle model names ending with "Model", e.g., "DeepARModel" is mapped to "DeepAR"
|
|
274
|
-
if isinstance(key, str):
|
|
275
|
-
key = normalize_model_type_name(key)
|
|
276
|
-
if not isinstance(value, list):
|
|
277
|
-
value = [value]
|
|
278
|
-
hyperparameters_clean[key].extend(value)
|
|
279
|
-
|
|
280
|
-
if must_contain_searchspace:
|
|
281
|
-
verify_contains_at_least_one_searchspace(hyperparameters_clean)
|
|
282
|
-
else:
|
|
283
|
-
verify_contains_no_searchspaces(hyperparameters_clean)
|
|
284
|
-
|
|
285
|
-
return dict(hyperparameters_clean)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
def get_model_name(ag_args: Dict[str, Any], model_type: Type[AbstractTimeSeriesModel]) -> str:
|
|
289
|
-
name = ag_args.get("name")
|
|
290
|
-
if name is None:
|
|
291
|
-
name_stem = re.sub(r"Model$", "", model_type.__name__)
|
|
292
|
-
name_prefix = ag_args.get("name_prefix", "")
|
|
293
|
-
name_suffix = ag_args.get("name_suffix", "")
|
|
294
|
-
name = name_prefix + name_stem + name_suffix
|
|
295
|
-
return name
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
def contains_searchspace(model_hyperparameters: ModelHyperparameters) -> bool:
|
|
299
|
-
for hp_value in model_hyperparameters.values():
|
|
300
|
-
if isinstance(hp_value, space.Space):
|
|
301
|
-
return True
|
|
302
|
-
return False
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
def verify_contains_at_least_one_searchspace(hyperparameters: Dict[str, List[ModelHyperparameters]]):
|
|
306
|
-
for model, model_hps_list in hyperparameters.items():
|
|
307
|
-
for model_hps in model_hps_list:
|
|
308
|
-
if contains_searchspace(model_hps):
|
|
309
|
-
return
|
|
310
|
-
|
|
311
|
-
raise ValueError(
|
|
312
|
-
"Hyperparameter tuning specified, but no model contains a hyperparameter search space. "
|
|
313
|
-
"Please disable hyperparameter tuning with `hyperparameter_tune_kwargs=None` or provide a search space "
|
|
314
|
-
"for at least one model."
|
|
315
|
-
)
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
def verify_contains_no_searchspaces(hyperparameters: Dict[str, List[ModelHyperparameters]]):
|
|
319
|
-
for model, model_hps_list in hyperparameters.items():
|
|
320
|
-
for model_hps in model_hps_list:
|
|
321
|
-
if contains_searchspace(model_hps):
|
|
322
|
-
raise ValueError(
|
|
323
|
-
f"Hyperparameter tuning not specified, so hyperparameters must have fixed values. "
|
|
324
|
-
f"However, for model {model} hyperparameters {model_hps} contain a search space."
|
|
325
|
-
)
|