My trained and updated XGB model just returned NAN...
# mlforecast
j
My trained and updated XGB model just returned NAN as forecast values for all unique_ids and all future timesteps. anybody encountered something like this? No error or so, just NaNs everywhere. any idea?
same problem if i skip the updating.
v
Might be an indexing issue
j
based on what exactly? i use the same code for all my models. i trained approximately 100 models or more. and now in this one case i get nans. my quick fix is now to just train a new model. my feeling is that it is something inside xgb where a specific combination of settings yields nan, but i would love to understand what 🙂
v
Before you call fit and predict, try seeing if calling .reset_index() on the dataframe fixes the issue. Of course, make sure you're passing in the right target variables for predict as well, and that the dataframe is nonempty
j
You can also use the save features callback to inspect the model inputs and see if the NaNs are coming from the model itself (by running them through the predict step like:
fcst.models_['xgb'].predict(input_features)
) or some postprocessing
j
ah, ok. never done this. thx!