awslabs / gluonts

Probabilistic time series modeling in Python
https://ts.gluon.ai
Apache License 2.0
4.55k stars 747 forks source link

Feature importance from train gluonts model #1419

Open adarwade1 opened 3 years ago

adarwade1 commented 3 years ago

Description

Currently no option available with GluonTS framwork to get details on important features considered by train model. We tried to check estimator object of train model. It provide list of features used however not weightage for each feature.

References

adarwade1 commented 3 years ago

Is there any way, user can able to get coefficients and weights of features. As per documentation in tutorial, estimator contain model along with parameters weights and coefficients. However explore all the methods available as part of predictor, not able to locate coefficients Please advise.

mbohlkeschneider commented 3 years ago

Hi @adarwade1,

thank you for raising this issue. There is no principled way to get feature importance out of GluonTS estimators. You could check the weights associated with the first layer that the features are passed through, but the values are probably not meaningful because of the non-linear transformations happening afterwards.

StatMixedML commented 3 years ago

One way to provide insights into feature importance of the model is to use attention-weights, as used by the Temporal-Fusion-Transformer.

@mbohlkeschneider Any plans to provide some convenience functions in gluonts TFT- implementation? Would be great!

Pravesh001 commented 2 years ago

Hello @Devs and @Contributors, Our project also required feature selection to be done as we are training the DeepAR model with many features(~250). A) Can we expect this feature to find feature importance from the trained model in the upcoming version? B) Is there anything that could help in slicing down the number of features apart from getting it from the trained model? Thanks

mbohlkeschneider commented 2 years ago

Hi @Pravesh001,

Thank you for your comment. There are currently no plans to add a feature selection module from our end. 250 features really sounds like a lot! I would first try to understand whether they actually help. My experience is that many features are rather detrimental than helping and doing simple forward feature selection with the most promising features worked for me.

One caveat for feature selection in the forecasting setup is that some features are useful to fix issues in the model that are very specific. For example, a Christmas flag could help forecasting with lower error around Christmas, but will hardly do anything else beyond that. Thus, one has to construct specific cases to measure the impact of such features.

Pravesh001 commented 2 years ago

simple forward feature selection

Hello @mbohlkeschneider,

Thank you for such a quick and elaborated reply. I'll try implementing these techniques at my end and let you know the update.

Thanks

Steviey commented 1 year ago

+1