Question about feat_static_cat #1046
|
In the extended tutorial, What are examples of static categorical features? Are these features to identify individual time series, in case one wants to perform multivariate time series forecasting? |
Replies: 9 comments 5 replies
|
Example: If you have 5 different categorical features, the dimension needs to be 5. Typically, you can have a categorical feature to identify groups of time series. E.g., all time series with categorical features A have a certain time of seasonality or a high volume or something, whereas time series with another feature behave differently. |
|
Hi @timoschowski, I was just searching for At the moment this trains fine, but it is not using |
|
@alexhallam is this a single or multivariate time series? |
|
Well, I know that I can model each of these series individually, but I also wanted to compare those results with using each time series key as a feature. A pooled vs non-pooled set up. What I am trying to do above is use each time series as a categorical feature. |
|
@alexhallam You might want to try the following for creating your dataset (using the code-snippet from above) from gluonts.dataset.common import ListDataset
from gluonts.dataset.field_names import FieldName
data_list = ListDataset(
[
{FieldName.START: pd.Timestamp(df_cats.iloc[:, col_idx].index[0], freq = "d"),
FieldName.TARGET: df_cats.iloc[:, col_idx].values,
FieldName.ITEM_ID: df_cats.columns[col_idx],
FieldName.FEAT_STATIC_CAT: np.array([col_idx]),
}
for col_idx in range(df_cats.shape[1])
],
freq="d"
)It creates the dataset that can be used for model training. You can check out some of the entries of data_list.list_data[0]showing {'start': Timestamp('1970-01-01 00:00:00', freq='D'),
'target': array([0, 0, 0, ..., 0, 0, 0], dtype=uint8),
'item_id': 'part_10055165',
'feat_static_cat': array([0])}The categorical feature |
|
This answers the question for me. What do you think @NielsRogge? |
|
Hi can use_feat_static_cat be used in deepVAR? it seems that the model does not recognize it |
|
Hi @ShirleyMgit,
Hope that answers your question. |
|
Hi @ShirleyMgit, I see. I'm not aware of a model that does that in GluonTS. The DeepVAR model code is here: https://github.com/awslabs/gluonts/tree/dev/src/gluonts/mx/model/deepvar. If you add that, feel free to send us a PR! |
Example: If you have 5 different categorical features, the dimension needs to be 5.
Typically, you can have a categorical feature to identify groups of time series. E.g., all time series with categorical features A have a certain time of seasonality or a high volume or something, whereas time series with another feature behave differently.