XGBoostError:[18:46:19] D:\Build\xgboost\xgboost-1.6-1.git\src\data\data.cc:487:Check failed: valid: Label contains NaN, infinity or a value too large
This is a long shot, but I was having a similar error and couldn't figure it out. It turns out I was doing a log transform right before I tossed my data into the regressor, and I had negative values in my output that were going to infinity. I didn't catch it because I looked for NAs/infinite values before it hit the log transform part of the pipeline.
I am trying to use XGBRegressor for my data but keep getting the above error when doing a model.fit.
I have tried:
np.any(np.isnan(df))
np.all(np.isfinite(df))
which are both true.
I tried getting rid of the inf and null values using:
df.replace([np.inf, -np.inf], np.nan, inplace=True)
df.fillna(0, inplace=True)
but the error still occurs.
np.all(np.isfinite(df)) is still showing true.
Most errors I found on the website says "Input contains.." and not "Label contains.."