I am training a DeepAR model (arXiv) in Jupyter Notebook. I am following this tutorial.

I create a collection of time series (concat_df), as needed by the DeepAR method:

enter image description here

Each row is a time series. This collection is used to train the DeepAR model. The input format expected by DeepAr is a list of series. So I create this from the above data frame:

time_series = []
for index, row in concat_df.iterrows():

With this list of time series I then set the freq, prediction_length and context_length (note I am setting frequency to Daily in this first example):

freq = "D"
prediction_length = 3
context_length = 3

...as well as the T-Naught, Data Length, Number of Time Series and Period:

t0 = concat_df.columns[0]
data_length = concat_df.shape[1]
num_ts = concat_df.shape[0]
period = 12

I create the training set:

time_series_training = []
for ts in time_series:

..and visualize this with the test set:

time_series_training[0].plot(label="train", ls=":")

enter image description here

So far so good, everything seems to agree with the tutorial.

I then use the remaining code to invoke the deployed model as explained in the referenced article:

list_of_df = predictor.predict(time_series_training[:5], content_type="application/json")

BUT, if I change the frequency to monthly (freq = "M") I get the following error:

ValueError: Units 'M', 'Y', and 'y' are no longer supported, as they do not represent unambiguous timedelta values durations.

Why would monthly data not be accepted? How can I train monthly data on DeepAR? Is there a way to specify some daily equivalent to monthly data?

This appears to be some kind of Pandas error, as shown here.

  • $\begingroup$ it seems one can use W as weekly time maximum, rest are not supported $\endgroup$
    – Nikos M.
    Nov 14 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.