Closed Christotoooo closed 4 years ago
Hello,
the shape of feat_static_cat should be 55
in this case.
In my view the DeepAR documentation explains how to use it quite well. Note that the field-name is cat
instead of feat_static_cat
there.
Hi @Christotoooo I am facing the same issue, I have 12 categorical features but I can't find a way to use them because I get the same error: GluonTSDataError: Array 'feat_static_cat' has bad shape - expected 1 dimensions, got 2
which in my case is normal shape (data_size, n_cat_feature) = (10500, 12)
.
series = []
for group in sample_df.groupby('ref'):
id, group_df = group
series.append({
FieldName.ITEM_ID: id,
FieldName.TARGET: group_df[target_col].values,
FieldName.START: group_df['timestamp'].min(),
FieldName.FEAT_DYNAMIC_REAL: [group_df[col].values for col in input_cols],
FieldName.FEAT_STATIC_CAT: [ group_df[col].values for col in static_cat],
})
from gluonts.dataset.common import ListDataset
# Create GluonTS dataset from list of dictionaries
ds = ListDataset(series, freq='1H')
Hi @deltawi Were you able to solve this problem? I am having the same problem, I am not sure how to solve it.
Hi @deltawi Were you able to solve this problem? I am having the same problem, I am not sure how to solve it.
I switched to Pytorch Forecasting library which implements TFT and is a lot more stable than gluonTS.
Hello, thanks for reviewing this:) I am using deepar to forecast sales of multiple products so my input shape might be a little bit different from single time series forecasting. Since I have 1917 time series with 55 categorical features, my input-list shape for "feat_static_cat" is (1917,55). I could not find documentation for multiple ts forecasting of gluonts so that was my best guess based on my experience of using sagemaker. However, that gives me an error:
I am confused about why it is expecting something of dimension 1. Is it because it does not know that I am passing multiple time series?
My model init looks like this:
Thank you in advance :)