I am getting a frequency error when useing Pandasdataset in DeepAREstimator. it is always giving an error. I attached the error below, #3170
subbarajugv
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
from gluonts.mx import DeepAREstimator, Trainer
estimator = DeepAREstimator(
freq='H', prediction_length=24, trainer=Trainer(epochs=1)
)
predictor = estimator.train(ds)
predictions = predictor.predict(ds)
/home/subbi/miniforge3/lib/python3.10/site-packages/gluonts/time_feature/lag.py:104: FutureWarning: 'H' is deprecated and will be removed in a future version, please use 'h' instead.
offset = to_offset(freq_str)
Exception Traceback (most recent call last)
Cell In[132], line 3
1 from gluonts.mx import DeepAREstimator, Trainer
----> 3 estimator = DeepAREstimator(
4 freq='H', prediction_length=24, trainer=Trainer(epochs=1)
5 )
6 predictor = estimator.train(ds)
7 predictions = predictor.predict(ds)
File ~/miniforge3/lib/python3.10/site-packages/gluonts/core/component.py:364, in validated..validator..init_wrapper(*args, **kwargs)
361 self.class.getnewargs_ex = validated_getnewargs_ex
362 self.class.repr = validated_repr
--> 364 return init(self, **all_args)
File ~/miniforge3/lib/python3.10/site-packages/gluonts/mx/model/deepar/_estimator.py:256, in DeepAREstimator.init(self, freq, prediction_length, trainer, context_length, num_layers, num_cells, cell_type, dropoutcell_type, dropout_rate, use_feat_dynamic_real, use_feat_static_cat, use_feat_static_real, cardinality, embedding_dimension, distr_output, scaling, lags_seq, time_features, num_parallel_samples, imputation_method, train_sampler, validation_sampler, dtype, alpha, beta, batch_size, default_scale, minimum_scale, impute_missing_values, num_imputation_samples, nonnegative_pred_samples)
247 self.embedding_dimension = (
248 embedding_dimension
249 if embedding_dimension is not None
250 else [min(50, (cat + 1) // 2) for cat in self.cardinality]
251 )
252 self.scaling = scaling
253 self.lags_seq = (
254 lags_seq
255 if lags_seq is not None
--> 256 else get_lags_for_frequency(freq_str=freq)
257 )
258 self.time_features = (
259 time_features
260 if time_features is not None
261 else time_features_from_frequency_str(freq)
262 )
264 self.history_length = self.context_length + max(self.lags_seq)
File ~/miniforge3/lib/python3.10/site-packages/gluonts/time_feature/lag.py:149, in get_lags_for_frequency(freq_str, lag_ub, num_lags, num_default_lags)
143 lags = (
144 _make_lags_for_second(offset.n)
145 + _make_lags_for_minute(offset.n / 60)
146 + _make_lags_for_hour(offset.n / (60 * 60))
147 )
148 else:
--> 149 raise Exception("invalid frequency")
151 # flatten lags list and filter
152 lags = [
153 int(lag) for sub_list in lags for lag in sub_list if 7 < lag <= lag_ub
154 ]
Exception: invalid frequency
Beta Was this translation helpful? Give feedback.
All reactions