Before predicting
Inspecting the input
We can define a function that displays our input dataframe before predicting.before_predict_callback
argument of
MLForecast.predict
.
unique_id | lag1 | lag2 | |
---|---|---|---|
0 | id_0 | 4.15593 | 3.000028 |
unique_id | lag1 | lag2 | |
---|---|---|---|
0 | id_0 | 5.250205 | 4.15593 |
unique_id | ds | LGBMRegressor | |
---|---|---|---|
0 | id_0 | 2000-08-10 | 5.250205 |
1 | id_0 | 2000-08-11 | 6.241739 |
Saving the input features
Saving the features that are sent as input to the model in each timestamp can be helpful, for example to estimate SHAP values. This can be easily achieved with theSaveFeatures
callback.
unique_id | lag1 | |
---|---|---|
0 | id_0 | 4.155930 |
1 | id_0 | 5.281643 |
After predicting
When predicting with the recursive strategy (the default) the predictions for each timestamp are used to update the target and recompute the features. If you want to do something to these predictions before that happens you can use theafter_predict_callback
argument of
MLForecast.predict
.