autogluon.timeseries 1.1.2b20241109__py3-none-any.whl → 1.1.2b20241111__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 +5 -1
- autogluon/timeseries/models/abstract/abstract_timeseries_model.py +73 -5
- autogluon/timeseries/models/gluonts/abstract_gluonts.py +1 -0
- autogluon/timeseries/models/local/abstract_local_model.py +4 -1
- autogluon/timeseries/models/local/statsforecast.py +3 -0
- autogluon/timeseries/models/multi_window/multi_window_model.py +5 -0
- autogluon/timeseries/predictor.py +1 -1
- autogluon/timeseries/regressor.py +146 -0
- autogluon/timeseries/transforms/scaler.py +1 -1
- autogluon/timeseries/version.py +1 -1
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/METADATA +4 -4
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/RECORD +19 -18
- /autogluon.timeseries-1.1.2b20241109-py3.8-nspkg.pth → /autogluon.timeseries-1.1.2b20241111-py3.8-nspkg.pth +0 -0
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/LICENSE +0 -0
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/NOTICE +0 -0
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/WHEEL +0 -0
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/namespace_packages.txt +0 -0
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/top_level.txt +0 -0
- {autogluon.timeseries-1.1.2b20241109.dist-info → autogluon.timeseries-1.1.2b20241111.dist-info}/zip-safe +0 -0
@@ -921,7 +921,11 @@ class TimeSeriesDataFrame(pd.DataFrame, TimeSeriesDataFrameDeprecatedMixin):
|
|
921
921
|
test_data : TimeSeriesDataFrame
|
922
922
|
Test portion of the data. Contains the slice ``[:end_idx]`` of each time series in the original dataset.
|
923
923
|
"""
|
924
|
-
|
924
|
+
df = self
|
925
|
+
if not df.index.is_monotonic_increasing:
|
926
|
+
logger.warning("Sorting the dataframe index before generating the train/test split.")
|
927
|
+
df = df.sort_index()
|
928
|
+
test_data = df.slice_by_timestep(None, end_index)
|
925
929
|
train_data = test_data.slice_by_timestep(None, -prediction_length)
|
926
930
|
|
927
931
|
if suffix is not None:
|
@@ -5,6 +5,8 @@ import time
|
|
5
5
|
from contextlib import nullcontext
|
6
6
|
from typing import Dict, List, Optional, Union
|
7
7
|
|
8
|
+
import pandas as pd
|
9
|
+
|
8
10
|
from autogluon.common import space
|
9
11
|
from autogluon.common.loaders import load_pkl
|
10
12
|
from autogluon.common.savers import save_pkl
|
@@ -13,8 +15,10 @@ from autogluon.core.hpo.executors import HpoExecutor, RayHpoExecutor
|
|
13
15
|
from autogluon.core.models import AbstractModel
|
14
16
|
from autogluon.timeseries.dataset import TimeSeriesDataFrame
|
15
17
|
from autogluon.timeseries.metrics import TimeSeriesScorer, check_get_evaluation_metric
|
18
|
+
from autogluon.timeseries.regressor import CovariateRegressor
|
16
19
|
from autogluon.timeseries.transforms import LocalTargetScaler, get_target_scaler_from_name
|
17
20
|
from autogluon.timeseries.utils.features import CovariateMetadata
|
21
|
+
from autogluon.timeseries.utils.forecast import get_forecast_horizon_index_ts_dataframe
|
18
22
|
from autogluon.timeseries.utils.warning_filters import disable_stdout, warning_filter
|
19
23
|
|
20
24
|
from .model_trial import model_trial, skip_hpo
|
@@ -164,6 +168,8 @@ class AbstractTimeSeriesModel(AbstractModel):
|
|
164
168
|
def _initialize(self, **kwargs) -> None:
|
165
169
|
self._init_params_aux()
|
166
170
|
self._init_params()
|
171
|
+
self.target_scaler = self._create_target_scaler()
|
172
|
+
self.covariate_regressor = self._create_covariate_regressor()
|
167
173
|
|
168
174
|
def _compute_fit_metadata(self, val_data: TimeSeriesDataFrame = None, **kwargs):
|
169
175
|
fit_metadata = dict(
|
@@ -208,7 +214,11 @@ class AbstractTimeSeriesModel(AbstractModel):
|
|
208
214
|
return info
|
209
215
|
|
210
216
|
def fit(
|
211
|
-
self,
|
217
|
+
self,
|
218
|
+
train_data: TimeSeriesDataFrame,
|
219
|
+
val_data: Optional[TimeSeriesDataFrame] = None,
|
220
|
+
time_limit: Optional[float] = None,
|
221
|
+
**kwargs,
|
212
222
|
) -> "AbstractTimeSeriesModel":
|
213
223
|
"""Fit timeseries model.
|
214
224
|
|
@@ -243,22 +253,33 @@ class AbstractTimeSeriesModel(AbstractModel):
|
|
243
253
|
model: AbstractTimeSeriesModel
|
244
254
|
The fitted model object
|
245
255
|
"""
|
256
|
+
start_time = time.monotonic()
|
246
257
|
self.initialize(**kwargs)
|
247
|
-
self.target_scaler = self._create_target_scaler()
|
248
258
|
if self.target_scaler is not None:
|
249
259
|
train_data = self.target_scaler.fit_transform(train_data)
|
250
260
|
|
261
|
+
if self.covariate_regressor is not None:
|
262
|
+
train_data = self.covariate_regressor.fit_transform(
|
263
|
+
train_data,
|
264
|
+
time_limit=0.5 * time_limit if time_limit is not None else None,
|
265
|
+
)
|
266
|
+
|
251
267
|
train_data = self.preprocess(train_data, is_train=True)
|
252
268
|
if self._get_tags()["can_use_val_data"] and val_data is not None:
|
253
269
|
if self.target_scaler is not None:
|
254
270
|
val_data = self.target_scaler.transform(val_data)
|
271
|
+
if self.covariate_regressor is not None:
|
272
|
+
val_data = self.covariate_regressor.transform(val_data)
|
255
273
|
val_data = self.preprocess(val_data, is_train=False)
|
256
|
-
|
274
|
+
|
275
|
+
if time_limit is not None:
|
276
|
+
time_limit = time_limit - (time.monotonic() - start_time)
|
277
|
+
return super().fit(train_data=train_data, val_data=val_data, time_limit=time_limit, **kwargs)
|
257
278
|
|
258
279
|
@property
|
259
280
|
def allowed_hyperparameters(self) -> List[str]:
|
260
281
|
"""List of hyperparameters allowed by the model."""
|
261
|
-
return ["target_scaler"]
|
282
|
+
return ["target_scaler", "covariate_regressor"]
|
262
283
|
|
263
284
|
def _create_target_scaler(self) -> Optional[LocalTargetScaler]:
|
264
285
|
"""Create a LocalTargetScaler object based on the value of the `target_scaler` hyperparameter."""
|
@@ -269,6 +290,32 @@ class AbstractTimeSeriesModel(AbstractModel):
|
|
269
290
|
else:
|
270
291
|
return None
|
271
292
|
|
293
|
+
def _create_covariate_regressor(self) -> Optional[CovariateRegressor]:
|
294
|
+
"""Create a CovariateRegressor object based on the value of the `covariate_regressor` hyperparameter."""
|
295
|
+
covariate_regressor = self._get_model_params().get("covariate_regressor")
|
296
|
+
if covariate_regressor is not None:
|
297
|
+
if len(self.metadata.known_covariates + self.metadata.static_features) == 0:
|
298
|
+
logger.debug(
|
299
|
+
"Skipping CovariateRegressor since the dataset contains no covariates or static features."
|
300
|
+
)
|
301
|
+
return None
|
302
|
+
else:
|
303
|
+
if isinstance(covariate_regressor, str):
|
304
|
+
return CovariateRegressor(covariate_regressor, target=self.target, metadata=self.metadata)
|
305
|
+
elif isinstance(covariate_regressor, CovariateRegressor):
|
306
|
+
logger.warning(
|
307
|
+
"Using a custom CovariateRegressor object is experimental functionality that may break in the future!"
|
308
|
+
)
|
309
|
+
covariate_regressor.target = self.target
|
310
|
+
covariate_regressor.metadata = self.metadata
|
311
|
+
return covariate_regressor
|
312
|
+
else:
|
313
|
+
raise ValueError(
|
314
|
+
f"Invalid value for covariate_regressor {covariate_regressor} of type {type(covariate_regressor)}"
|
315
|
+
)
|
316
|
+
else:
|
317
|
+
return None
|
318
|
+
|
272
319
|
def _fit(
|
273
320
|
self,
|
274
321
|
train_data: TimeSeriesDataFrame,
|
@@ -324,11 +371,19 @@ class AbstractTimeSeriesModel(AbstractModel):
|
|
324
371
|
"""
|
325
372
|
if self.target_scaler is not None:
|
326
373
|
data = self.target_scaler.fit_transform(data)
|
374
|
+
if self.covariate_regressor is not None:
|
375
|
+
data = self.covariate_regressor.fit_transform(data)
|
327
376
|
|
328
377
|
data = self.preprocess(data, is_train=False)
|
329
378
|
known_covariates = self.preprocess_known_covariates(known_covariates)
|
379
|
+
|
380
|
+
# FIXME: Set self.covariate_regressor=None so to avoid copying it across processes during _predict
|
381
|
+
# FIXME: The clean solution is to convert all methods executed in parallel to @classmethod
|
382
|
+
covariate_regressor = self.covariate_regressor
|
383
|
+
self.covariate_regressor = None
|
330
384
|
predictions = self._predict(data=data, known_covariates=known_covariates, **kwargs)
|
331
|
-
|
385
|
+
self.covariate_regressor = covariate_regressor
|
386
|
+
|
332
387
|
# "0.5" might be missing from the quantiles if self is a wrapper (MultiWindowBacktestingModel or ensemble)
|
333
388
|
if "0.5" in predictions.columns:
|
334
389
|
if self.eval_metric.optimized_by_median:
|
@@ -336,6 +391,19 @@ class AbstractTimeSeriesModel(AbstractModel):
|
|
336
391
|
if self.must_drop_median:
|
337
392
|
predictions = predictions.drop("0.5", axis=1)
|
338
393
|
|
394
|
+
if self.covariate_regressor is not None:
|
395
|
+
if known_covariates is None:
|
396
|
+
forecast_index = get_forecast_horizon_index_ts_dataframe(
|
397
|
+
data, prediction_length=self.prediction_length, freq=self.freq
|
398
|
+
)
|
399
|
+
known_covariates = pd.DataFrame(index=forecast_index, dtype="float32")
|
400
|
+
|
401
|
+
predictions = self.covariate_regressor.inverse_transform(
|
402
|
+
predictions,
|
403
|
+
known_covariates=known_covariates,
|
404
|
+
static_features=data.static_features,
|
405
|
+
)
|
406
|
+
|
339
407
|
if self.target_scaler is not None:
|
340
408
|
predictions = self.target_scaler.inverse_transform(predictions)
|
341
409
|
return predictions
|
@@ -353,6 +353,7 @@ class AbstractGluonTSModel(AbstractTimeSeriesModel):
|
|
353
353
|
columns = self.metadata.known_covariates_real
|
354
354
|
if self.supports_known_covariates and len(columns) > 0:
|
355
355
|
assert "known" in self._real_column_transformers, "Preprocessing pipeline must be fit first"
|
356
|
+
known_covariates = known_covariates.copy()
|
356
357
|
known_covariates[columns] = self._real_column_transformers["known"].transform(known_covariates[columns])
|
357
358
|
return known_covariates
|
358
359
|
|
@@ -113,8 +113,11 @@ class AbstractLocalModel(AbstractTimeSeriesModel):
|
|
113
113
|
local_model_args = {}
|
114
114
|
# TODO: Move filtering logic to AbstractTimeSeriesModel
|
115
115
|
for key, value in raw_local_model_args.items():
|
116
|
-
if key in self.
|
116
|
+
if key in self.allowed_local_model_args:
|
117
117
|
local_model_args[key] = value
|
118
|
+
elif key in self.allowed_hyperparameters:
|
119
|
+
# Quietly ignore params in self.allowed_hyperparameters - they are used by AbstractTimeSeriesModel
|
120
|
+
pass
|
118
121
|
else:
|
119
122
|
unused_local_model_args.append(key)
|
120
123
|
|
@@ -129,6 +129,7 @@ class AutoARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
129
129
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
130
130
|
"""
|
131
131
|
|
132
|
+
init_time_in_seconds = 0 # C++ models require no compilation
|
132
133
|
allowed_local_model_args = [
|
133
134
|
"d",
|
134
135
|
"D",
|
@@ -206,6 +207,7 @@ class ARIMAModel(AbstractProbabilisticStatsForecastModel):
|
|
206
207
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
207
208
|
"""
|
208
209
|
|
210
|
+
init_time_in_seconds = 0 # C++ models require no compilation
|
209
211
|
allowed_local_model_args = [
|
210
212
|
"order",
|
211
213
|
"seasonal_order",
|
@@ -261,6 +263,7 @@ class AutoETSModel(AbstractProbabilisticStatsForecastModel):
|
|
261
263
|
This significantly speeds up fitting and usually leads to no change in accuracy.
|
262
264
|
"""
|
263
265
|
|
266
|
+
init_time_in_seconds = 0 # C++ models require no compilation
|
264
267
|
allowed_local_model_args = [
|
265
268
|
"damped",
|
266
269
|
"model",
|
@@ -12,6 +12,7 @@ import autogluon.core as ag
|
|
12
12
|
from autogluon.timeseries.dataset.ts_dataframe import TimeSeriesDataFrame
|
13
13
|
from autogluon.timeseries.models.abstract import AbstractTimeSeriesModel
|
14
14
|
from autogluon.timeseries.models.local.abstract_local_model import AbstractLocalModel
|
15
|
+
from autogluon.timeseries.regressor import CovariateRegressor
|
15
16
|
from autogluon.timeseries.splitter import AbstractWindowSplitter, ExpandingWindowSplitter
|
16
17
|
from autogluon.timeseries.transforms import LocalTargetScaler
|
17
18
|
|
@@ -89,6 +90,10 @@ class MultiWindowBacktestingModel(AbstractTimeSeriesModel):
|
|
89
90
|
# Do not use scaler in the MultiWindowModel to avoid duplication; it will be created in the inner model
|
90
91
|
return None
|
91
92
|
|
93
|
+
def _create_covariates_regressor(self) -> Optional[CovariateRegressor]:
|
94
|
+
# Do not use regressor in the MultiWindowModel to avoid duplication; it will be created in the inner model
|
95
|
+
return None
|
96
|
+
|
92
97
|
def _fit(
|
93
98
|
self,
|
94
99
|
train_data: TimeSeriesDataFrame,
|
@@ -293,7 +293,7 @@ class TimeSeriesPredictor(TimeSeriesPredictorDeprecatedMixin):
|
|
293
293
|
df = self._to_data_frame(data, name=name)
|
294
294
|
if not pd.api.types.is_numeric_dtype(df[self.target]):
|
295
295
|
raise ValueError(f"Target column {name}['{self.target}'] has a non-numeric dtype {df[self.target].dtype}")
|
296
|
-
df
|
296
|
+
df = df.assign(**{self.target: df[self.target].astype("float64")})
|
297
297
|
# MultiIndex.is_monotonic_increasing checks if index is sorted by ["item_id", "timestamp"]
|
298
298
|
if not df.index.is_monotonic_increasing:
|
299
299
|
df = df.sort_index()
|
@@ -0,0 +1,146 @@
|
|
1
|
+
from typing import Any, Dict, Optional
|
2
|
+
|
3
|
+
import numpy as np
|
4
|
+
import pandas as pd
|
5
|
+
|
6
|
+
from autogluon.core.models import AbstractModel
|
7
|
+
from autogluon.tabular.trainer.model_presets.presets import MODEL_TYPES as TABULAR_MODEL_TYPES
|
8
|
+
from autogluon.timeseries.dataset.ts_dataframe import ITEMID, TimeSeriesDataFrame
|
9
|
+
from autogluon.timeseries.utils.features import CovariateMetadata
|
10
|
+
|
11
|
+
|
12
|
+
class CovariateRegressor:
|
13
|
+
"""Predicts target values from the covariates for the same observation.
|
14
|
+
|
15
|
+
The model construct the feature matrix using known_covariates and static_features.
|
16
|
+
|
17
|
+
Parameters
|
18
|
+
----------
|
19
|
+
model_name : str
|
20
|
+
Name of the tabular regression model. See `autogluon.tabular.trainer.model_presets.presets.MODEL_TYPES` for the
|
21
|
+
list of available models.
|
22
|
+
model_hyperparameters : dict or None
|
23
|
+
Hyperparameters passed to the tabular regression model.
|
24
|
+
eval_metric : str
|
25
|
+
Metric provided as `eval_metric` to the tabular regression model. Must be compatible with `problem_type="regression"`.
|
26
|
+
refit_during_predict : bool
|
27
|
+
If True, the model will be re-trained every time `fit_transform` is called. If False, the model will only be
|
28
|
+
trained the first time that `fit_transform` is called, and future calls to `fit_transform` will only perform a
|
29
|
+
`transform`.
|
30
|
+
max_num_samples : int or None
|
31
|
+
If not None, training dataset passed to regression model will contain at most this many rows.
|
32
|
+
metadata : CovariateMetadata
|
33
|
+
Metadata object describing the covariates available in the dataset.
|
34
|
+
target : str
|
35
|
+
Name of the target column.
|
36
|
+
validation_frac : float, optional
|
37
|
+
Fraction of observations that are reserved as the validation set during training (starting from the end of each
|
38
|
+
time series).
|
39
|
+
"""
|
40
|
+
|
41
|
+
def __init__(
|
42
|
+
self,
|
43
|
+
model_name: str = "GBM",
|
44
|
+
model_hyperparameters: Optional[Dict[str, Any]] = None,
|
45
|
+
eval_metric: str = "mean_absolute_error",
|
46
|
+
refit_during_predict: bool = False,
|
47
|
+
max_num_samples: Optional[int] = 500_000,
|
48
|
+
metadata: Optional[CovariateMetadata] = None,
|
49
|
+
target: str = "target",
|
50
|
+
validation_fraction: Optional[float] = 0.1,
|
51
|
+
):
|
52
|
+
if model_name not in TABULAR_MODEL_TYPES:
|
53
|
+
raise ValueError(
|
54
|
+
f"Tabular model {model_name} not supported. Available models: {list(TABULAR_MODEL_TYPES)}"
|
55
|
+
)
|
56
|
+
self.target = target
|
57
|
+
self.model_type = TABULAR_MODEL_TYPES[model_name]
|
58
|
+
self.model_name = model_name
|
59
|
+
self.model_hyperparameters = model_hyperparameters or {}
|
60
|
+
self.refit_during_predict = refit_during_predict
|
61
|
+
self.tabular_eval_metric = eval_metric
|
62
|
+
self.max_num_samples = max_num_samples
|
63
|
+
self.validation_fraction = validation_fraction
|
64
|
+
self.model: Optional[AbstractModel] = None
|
65
|
+
self.metadata = metadata or CovariateMetadata()
|
66
|
+
|
67
|
+
def is_fit(self) -> bool:
|
68
|
+
return self.model is not None
|
69
|
+
|
70
|
+
def fit(self, data: TimeSeriesDataFrame, time_limit: Optional[float] = None, **kwargs) -> "CovariateRegressor":
|
71
|
+
"""Fit the tabular regressor on the target column using covariates as features."""
|
72
|
+
tabular_df = self._get_tabular_df(data, static_features=data.static_features, include_target=True)
|
73
|
+
tabular_df = tabular_df.query(f"{self.target}.notnull()")
|
74
|
+
|
75
|
+
median_ts_length = data.num_timesteps_per_item().median()
|
76
|
+
if self.validation_fraction is not None:
|
77
|
+
grouped_df = tabular_df.groupby(ITEMID)
|
78
|
+
val_size = max(int(self.validation_fraction * median_ts_length), 1)
|
79
|
+
train_df = self._subsample_df(grouped_df.head(-val_size))
|
80
|
+
val_df = self._subsample_df(grouped_df.tail(val_size))
|
81
|
+
X = train_df.drop(columns=[self.target])
|
82
|
+
y = train_df[self.target]
|
83
|
+
X_val = val_df.drop(columns=[self.target])
|
84
|
+
y_val = val_df[self.target]
|
85
|
+
else:
|
86
|
+
tabular_df = self._subsample_df(tabular_df)
|
87
|
+
X = tabular_df.drop(columns=[self.target])
|
88
|
+
y = tabular_df[self.target]
|
89
|
+
X_val = None
|
90
|
+
y_val = None
|
91
|
+
|
92
|
+
self.model = self.model_type(
|
93
|
+
problem_type="regression",
|
94
|
+
hyperparameters=self.model_hyperparameters,
|
95
|
+
eval_metric=self.tabular_eval_metric,
|
96
|
+
)
|
97
|
+
self.model.fit(X=X, y=y, X_val=X_val, y_val=y_val, time_limit=time_limit, **kwargs)
|
98
|
+
return self
|
99
|
+
|
100
|
+
def transform(self, data: TimeSeriesDataFrame) -> TimeSeriesDataFrame:
|
101
|
+
"""Subtract the tabular regressor predictions from the target column."""
|
102
|
+
y_pred = self._predict(data, static_features=data.static_features)
|
103
|
+
return data.assign(**{self.target: data[self.target] - y_pred})
|
104
|
+
|
105
|
+
def fit_transform(
|
106
|
+
self, data: TimeSeriesDataFrame, time_limit: Optional[float] = None, **kwargs
|
107
|
+
) -> TimeSeriesDataFrame:
|
108
|
+
if not self.is_fit() or self.refit_during_predict:
|
109
|
+
self.fit(data=data, time_limit=time_limit, **kwargs)
|
110
|
+
return self.transform(data=data)
|
111
|
+
|
112
|
+
def inverse_transform(
|
113
|
+
self,
|
114
|
+
predictions: TimeSeriesDataFrame,
|
115
|
+
known_covariates: TimeSeriesDataFrame,
|
116
|
+
static_features: Optional[pd.DataFrame],
|
117
|
+
) -> TimeSeriesDataFrame:
|
118
|
+
"""Add the tabular regressor predictions to the target column."""
|
119
|
+
y_pred = self._predict(known_covariates, static_features=static_features)
|
120
|
+
return predictions.assign(**{col: predictions[col] + y_pred for col in predictions.columns})
|
121
|
+
|
122
|
+
def _predict(self, data: TimeSeriesDataFrame, static_features: Optional[pd.DataFrame]) -> np.ndarray:
|
123
|
+
"""Construct the tabular features matrix and make predictions"""
|
124
|
+
tabular_df = self._get_tabular_df(data, static_features=static_features)
|
125
|
+
return self.model.predict(X=tabular_df)
|
126
|
+
|
127
|
+
def _get_tabular_df(
|
128
|
+
self,
|
129
|
+
data: TimeSeriesDataFrame,
|
130
|
+
static_features: Optional[pd.DataFrame] = None,
|
131
|
+
include_target: bool = False,
|
132
|
+
) -> pd.DataFrame:
|
133
|
+
"""Construct a tabular dataframe from known covariates and static features."""
|
134
|
+
available_columns = [ITEMID] + self.metadata.known_covariates
|
135
|
+
if include_target:
|
136
|
+
available_columns += [self.target]
|
137
|
+
tabular_df = pd.DataFrame(data).reset_index()[available_columns].astype({ITEMID: "category"})
|
138
|
+
if static_features is not None:
|
139
|
+
tabular_df = pd.merge(tabular_df, static_features, on=ITEMID)
|
140
|
+
return tabular_df
|
141
|
+
|
142
|
+
def _subsample_df(self, df: pd.DataFrame) -> pd.DataFrame:
|
143
|
+
"""Randomly subsample the dataframe if it contains more than self.max_num_samples rows."""
|
144
|
+
if self.max_num_samples is not None and len(df) > self.max_num_samples:
|
145
|
+
df = df.sample(n=self.max_num_samples)
|
146
|
+
return df
|
@@ -85,7 +85,7 @@ class LocalMinMaxScaler(LocalTargetScaler):
|
|
85
85
|
def _compute_loc_scale(self, target_series: pd.Series) -> Tuple[pd.Series, pd.Series]:
|
86
86
|
stats = target_series.abs().groupby(level=ITEMID, sort=False).agg(["min", "max"])
|
87
87
|
scale = (stats["max"] - stats["min"]).clip(lower=self.min_scale)
|
88
|
-
loc = stats["min"]
|
88
|
+
loc = stats["min"]
|
89
89
|
return loc, scale
|
90
90
|
|
91
91
|
|
autogluon/timeseries/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: autogluon.timeseries
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.2b20241111
|
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.
|
57
|
-
Requires-Dist: autogluon.common==1.1.
|
58
|
-
Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost]==1.1.
|
56
|
+
Requires-Dist: autogluon.core[raytune]==1.1.2b20241111
|
57
|
+
Requires-Dist: autogluon.common==1.1.2b20241111
|
58
|
+
Requires-Dist: autogluon.tabular[catboost,lightgbm,xgboost]==1.1.2b20241111
|
59
59
|
Provides-Extra: all
|
60
60
|
Requires-Dist: optimum[onnxruntime]<1.20,>=1.17; extra == "all"
|
61
61
|
Provides-Extra: chronos-onnx
|
@@ -1,14 +1,15 @@
|
|
1
|
-
autogluon.timeseries-1.1.
|
1
|
+
autogluon.timeseries-1.1.2b20241111-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
|
-
autogluon/timeseries/predictor.py,sha256=
|
5
|
+
autogluon/timeseries/predictor.py,sha256=R9m-TYmlA4WoJbdYEL_AnEM26EhRIclynOfSmpO7mBk,84926
|
6
|
+
autogluon/timeseries/regressor.py,sha256=wcYbvE7kFopdscubfhIfeLI3ovxKe_fUVtt0b1zWdV0,6823
|
6
7
|
autogluon/timeseries/splitter.py,sha256=eghGwAAN2_cxGk5aJBILgjGWtLzjxJcytMy49gg_q18,3061
|
7
|
-
autogluon/timeseries/version.py,sha256=
|
8
|
+
autogluon/timeseries/version.py,sha256=kh33Q3LDB5QcIlTzUZ64N8Y2DfFFBgbjxMIWQwKPcdk,90
|
8
9
|
autogluon/timeseries/configs/__init__.py,sha256=BTtHIPCYeGjqgOcvqb8qPD4VNX-ICKOg6wnkew1cPOE,98
|
9
10
|
autogluon/timeseries/configs/presets_configs.py,sha256=94-yL9teDHKs2irWjP3kpewI7FE1ChYCgEgz9XHJ6gc,1965
|
10
11
|
autogluon/timeseries/dataset/__init__.py,sha256=UvnhAN5tjgxXTHoZMQDy64YMDj4Xxa68yY7NP4vAw0o,81
|
11
|
-
autogluon/timeseries/dataset/ts_dataframe.py,sha256=
|
12
|
+
autogluon/timeseries/dataset/ts_dataframe.py,sha256=UQ-iT2dGVJF57hlGkivbSEaBwf-5NP0Amohp4DccLUA,48492
|
12
13
|
autogluon/timeseries/metrics/__init__.py,sha256=KzgXNj5or7RB_uadjgC8p5gxyV26zjj2hT58OmvnfmA,1875
|
13
14
|
autogluon/timeseries/metrics/abstract.py,sha256=9xCFQ3NaR1C0hn01M7oBd72a_CiNV-w6QFcRjwUbKYI,8183
|
14
15
|
autogluon/timeseries/metrics/point.py,sha256=xy8sKrBbuxZ7yTW21TDPayKnEj2FBj1AEseJxUdneqE,13399
|
@@ -17,7 +18,7 @@ autogluon/timeseries/metrics/utils.py,sha256=eJ63TCR-UwbeJ1c2Qm7B2q-8B3sFthPgioo
|
|
17
18
|
autogluon/timeseries/models/__init__.py,sha256=MYD9JJ-wUDE5B6jW6E6LU2eXQ6vflfQBvqQJkdzJa3A,1189
|
18
19
|
autogluon/timeseries/models/presets.py,sha256=ujNt_hft_5eNkh-Wj_Na9GBdBmI-JdnBnOEHq8X0qXc,11778
|
19
20
|
autogluon/timeseries/models/abstract/__init__.py,sha256=wvDsQAZIV0N3AwBeMaGItoQ82trEfnT-nol2AAOIxBg,102
|
20
|
-
autogluon/timeseries/models/abstract/abstract_timeseries_model.py,sha256=
|
21
|
+
autogluon/timeseries/models/abstract/abstract_timeseries_model.py,sha256=kVbJHyDWXmBJDL_4mUhEvpTG_d85vEjW5Og57d5CNN0,28092
|
21
22
|
autogluon/timeseries/models/abstract/model_trial.py,sha256=ENPg_7nsdxIvaNM0o0UShZ3x8jFlRmwRc5m0fGPC0TM,3720
|
22
23
|
autogluon/timeseries/models/autogluon_tabular/__init__.py,sha256=r9i6jWcyeLHYClkcMSKRVsfrkBUMxpDrTATNTBc_qgQ,136
|
23
24
|
autogluon/timeseries/models/autogluon_tabular/mlforecast.py,sha256=C1WVcuNlTcqo_qGm3v0uPpraO06mdVnBNeflPbCPjNQ,32861
|
@@ -31,21 +32,21 @@ autogluon/timeseries/models/ensemble/__init__.py,sha256=kFr11Gmt7lQJu9Rr8HuIPphQ
|
|
31
32
|
autogluon/timeseries/models/ensemble/abstract_timeseries_ensemble.py,sha256=tifETwmiEGt-YtQ9eNK7ojJ3fBvtFMUJvisbfkIJ7gw,3393
|
32
33
|
autogluon/timeseries/models/ensemble/greedy_ensemble.py,sha256=5HvZuW5osgsZg3V69k82nKEOy_YgeH1JTfQa7F3cU7s,7220
|
33
34
|
autogluon/timeseries/models/gluonts/__init__.py,sha256=asC1PTj4j9xMbilvk1IT1julnpeoKbv5ZNuAR6-DFgA,361
|
34
|
-
autogluon/timeseries/models/gluonts/abstract_gluonts.py,sha256=
|
35
|
+
autogluon/timeseries/models/gluonts/abstract_gluonts.py,sha256=tViaFXFOVjGQi2S6cUIW-ak0Evv7rKUm2QWsmpKDMEk,34076
|
35
36
|
autogluon/timeseries/models/gluonts/torch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
37
|
autogluon/timeseries/models/gluonts/torch/models.py,sha256=85MWDXPwDncGwLijkm-K1tS-05LvGq4Xl-WbbIcYCO8,24906
|
37
38
|
autogluon/timeseries/models/local/__init__.py,sha256=e2UImoJhmj70E148IIObv90C_bHxgyLNk6YsS4p7pfs,701
|
38
|
-
autogluon/timeseries/models/local/abstract_local_model.py,sha256=
|
39
|
+
autogluon/timeseries/models/local/abstract_local_model.py,sha256=OxEkqzfAd5diQDUYStw2nI-X2lo3H8GcMLDJ6-1XL_Y,12417
|
39
40
|
autogluon/timeseries/models/local/naive.py,sha256=iwRcFMFmJKPWPbD9TWaIUS51oav69F_VAp6-jb_5SUE,7249
|
40
41
|
autogluon/timeseries/models/local/npts.py,sha256=Bp74doKnfpGE8ywP4FWOCI_RwRMsmgocYDfGtq764DA,4143
|
41
|
-
autogluon/timeseries/models/local/statsforecast.py,sha256=
|
42
|
+
autogluon/timeseries/models/local/statsforecast.py,sha256=cFJ_A7LR2jTmFNGgMxt3xvEivQVYuV6bDCMii8-TKH0,32424
|
42
43
|
autogluon/timeseries/models/multi_window/__init__.py,sha256=Bq7AT2Jxdd4WNqmjTdzeqgNiwn1NCyWp4tBIWaM-zfI,60
|
43
|
-
autogluon/timeseries/models/multi_window/multi_window_model.py,sha256=
|
44
|
+
autogluon/timeseries/models/multi_window/multi_window_model.py,sha256=aNS0W4bh9quaxgFRtyJesVziPKHvg4lfCDrAQutqEjk,12014
|
44
45
|
autogluon/timeseries/trainer/__init__.py,sha256=lxiOT-Gc6BEnr_yWQqra85kEngeM_wtH2SCaRbmC_qE,170
|
45
46
|
autogluon/timeseries/trainer/abstract_trainer.py,sha256=hZI4QcsFvU1gxP2yv_DRCIMlc6q02ptR7UDA9EgJPoM,60409
|
46
47
|
autogluon/timeseries/trainer/auto_trainer.py,sha256=psJFZBwWWPlLjNwAgvO4OUJXsRW1sTN2YS9a4pdoeoE,3344
|
47
48
|
autogluon/timeseries/transforms/__init__.py,sha256=lzDavxdgGIz5m_DmSpNa9ewNU9Evndam3YXfOEk6kwY,174
|
48
|
-
autogluon/timeseries/transforms/scaler.py,sha256=
|
49
|
+
autogluon/timeseries/transforms/scaler.py,sha256=jgj9-637zgDREJidNpavKIQbF0y6RB_zwPGKWAGa6lw,5344
|
49
50
|
autogluon/timeseries/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
51
|
autogluon/timeseries/utils/features.py,sha256=VvBQzaymSSzxI9khtcXbpir-qo1NWHe51O7F6ynyh_s,21943
|
51
52
|
autogluon/timeseries/utils/forecast.py,sha256=p0WKM9Q0nLAwwmCgYZI1zi9mCOWXWJfllEt2lPRQl4M,1882
|
@@ -55,11 +56,11 @@ autogluon/timeseries/utils/datetime/base.py,sha256=3NdsH3NDq4cVAOSoy3XpaNixyNlbj
|
|
55
56
|
autogluon/timeseries/utils/datetime/lags.py,sha256=GoLtvcZ8oKb3QkoBJ9E59LSPLOP7Qjxrr2UmMSZgjyw,5909
|
56
57
|
autogluon/timeseries/utils/datetime/seasonality.py,sha256=h_4w00iEytAz_N_EpCENQ8RCXy7KQITczrYjBgVqWkQ,764
|
57
58
|
autogluon/timeseries/utils/datetime/time_features.py,sha256=PAXbYbQ0z_5GFbkxSNi41zLY_2-U3x0Ynm1m_WhdtGc,2572
|
58
|
-
autogluon.timeseries-1.1.
|
59
|
-
autogluon.timeseries-1.1.
|
60
|
-
autogluon.timeseries-1.1.
|
61
|
-
autogluon.timeseries-1.1.
|
62
|
-
autogluon.timeseries-1.1.
|
63
|
-
autogluon.timeseries-1.1.
|
64
|
-
autogluon.timeseries-1.1.
|
65
|
-
autogluon.timeseries-1.1.
|
59
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
60
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/METADATA,sha256=yJ5LwzR72cs1-XHuZ0YBdh4f3Bzv3C3URshC3ITRjqE,12388
|
61
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/NOTICE,sha256=7nPQuj8Kp-uXsU0S5so3-2dNU5EctS5hDXvvzzehd7E,114
|
62
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
63
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/namespace_packages.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
|
64
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/top_level.txt,sha256=giERA4R78OkJf2ijn5slgjURlhRPzfLr7waIcGkzYAo,10
|
65
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
66
|
+
autogluon.timeseries-1.1.2b20241111.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|