https://github.com/nixtla logo
#mlforecast
Title
# mlforecast
s

Slackbot

07/13/2023, 4:04 PM
This message was deleted.
j

José Morales

07/14/2023, 5:55 PM
Hey. I think you need the features used to compute the predictions as well. You can use the before_predict_callback argument of the predict method to save them and use these to compute the shap values afterwards
m

Max (Nixtla)

07/16/2023, 5:57 PM
@Rehan Javed, were you able to solve this?
j

José Morales

07/17/2023, 7:39 PM
I can provide a full example in a few of hours, but my idea is something like:
Copy code
from functools import partial

def extract_features(df, save_list):
 save_list.append(df)
 return df
save_list = []
extract_features_callback = partial(extract_features, save_list=save_list)
# pass this callback to predict
features = pd.concat(save_list)
You need to pass the one with the partial applied, the extract_features_callback
Yes, those are sorted by id and date. Glad it worked, I'll add a callaback to the library that does this so that you can use it in the future
🙌 1
2 Views