How to get feature importance of FB prophet?

Viewed 1767

I am using FB Prophet to do time-series forecast. I added two features--discount and promotion, and add holiday effect. The model fits well. But I want to get the feature importance to check how much contribution of 2 features. It seems FB Prophet does not have the feature importance function like other machine learning models "model.feature_importances_".

In FB Prophet, I can get the "forecast" dataframe, which contains : trend
yhat_lower
yhat_upper
trend_lower trend_upper discount_x
discount_lower
discount_upper
extra_regressors_multiplicative extra_regressors_multiplicative_lower
extra_regressors_multiplicative_upper
holidays holidays_lower
holidays_upper
multiplicative_terms multiplicative_terms_lower
multiplicative_terms_upper
promotion_x promotion_lower promotion_upper promotion_Day
promotion_Day_lower promotion_Day_upper weekly
weekly_lower
weekly_upper
additive_terms
additive_terms_lower
additive_terms_upper
yhat
y

In that case, how can I analyze the feature importance?

THANK YOU!

2 Answers

You can receive coefficients with following lines:

from prophet.utilities import regressor_coefficients
regressor_coef = regressor_coefficients(model)
regressor_coef[['regressor', 'regressor_mode', 'coef']].sort_values('coef')*

Use SHAP to get it. It will tell you what are the features and how much it is contributing on individual level as well.

Related