Open
Description
Hi,
My model is currently a LGBM model where multi_models = True
and forecast_horizon = 10
. Is there a way to plot a similar plot the one below where I can see how exactly a prediction is achieved from the features of the model?
The intermediate solution I have set up is to construct a dataframe to show the values with the below code:
#Set up shap explainer based on training data
shap_explainer = ShapExplainer(
model_estimator,
background_series=target_fit_series,
background_past_covariates=past_cov_fit_series,
background_future_covariates=future_cov_fit_series,
)
#Create a shap explain object based on test set period and forecast horizon I am interested in.
shap_explain_test = shap_explainer.explain(
foreground_series = target_hf[test_set_start_date: end_date],
foreground_past_covariates = past_cov_hf[test_set_start_date: end_date],
foreground_future_covariates = future_cov_hf[test_set_start_date: end_date],
horizons = [3]
)
#Get a dataframe showing how we get the forecasts from the features
horizon = 3
shap_results_df = shap_explain_test.get_explanation(horizon=horizon).pd_dataframe()
shap_results_df["shap_sum"] = shap_results_df.sum(axis=1)
shap_results_df["base_value"] = shap_explain_summary_val[horizon]["edm_power_feed_in_diff"].base_values[0]
shap_results_df["forecasts"] = shap_results_df["shap_sum"] + shap_results_df["base_value"]
shap_results_df["forecast_timestamp"] = shap_results_df.index + DateOffset(minutes=15 * (horizon - 1))
Is there a more straightforward way to get a similar waterfall plot above?