SHAP values for Prophet / time series data

1.7k Views Asked by At

I would like to utilize shap values for multivariate time series data and models like prophet.

from prophet import Prophet
ph = Prophet()

for column in time_series_df.drop(columns = ['y', 'ds'], inplace = False).columns:
    ph.add_regressor(column, standardize='auto', mode = 'additive')
ph.add_country_holidays('US')

ph.fit(time_series_df)

I now want to, utilize dalex (or shap) to get the shape values

import dalex
def predict_function(model, data):
    return model.predict(data)['yhat'].to_numpy()

dalex_ex = dalex.Explainer(ph, ph_train, label = 'y', predict_function = predict_function)

But it throws the following error:

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Is there a way how to handel data-time data better for those kind of algorithms?

0

There are 0 best solutions below