Why can equal-looking integer category labels still violate the XGBoost dataframe recoding contract?
Classic MLLevel: IntermediateXGBoost · Categorical data
Why can equal-looking integer category labels still violate the XGBoost dataframe recoding contract?
Hints
- Printed values hide dtype.
- Check signedness and supported category types.
Answer
Category name types must remain compatible; signed and unsigned integer categories can be treated differently. Preserve dtype/schema with the model and test validation and serving inputs, rather than comparing printed values only.
Source and licence: XGBoost · Categorical data · Apache-2.0 · answer: Quantoros editorial