Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent predictions with category feature #11160

Closed
xq-yu opened this issue Jan 12, 2025 · 2 comments
Closed

Inconsistent predictions with category feature #11160

xq-yu opened this issue Jan 12, 2025 · 2 comments

Comments

@xq-yu
Copy link

xq-yu commented Jan 12, 2025

xgboost predict result is Inconsistent in a same row when a category feature was created based on different basic dataframe. For example. here is 2 different dataframe A and B, but with same columns. And assume that there is one same sample(row) both in A and B. if we tried to transform a feature from string to category(xgboost is also trained with category feature) like

A['region'] = A['region'].astype('category') 
B['region'] = B['region'].astype('category') 

the prediction may be different even if the row's value is exactly the same.

@trivialfis
Copy link
Member

Currently, we rely on users to reuse the encoder during inference (like sklearn ordinal encoder). See our demos for an example. (demo/guide-python)

We are working on having a built-in recoder in XGBoost to memorize the encoding in the booster model #11088

@trivialfis
Copy link
Member

Closing in favor of #11088 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants