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

TPOT error for xgboost multiclass classificaion #1333

Open
kiranellur opened this issue Dec 3, 2023 · 1 comment
Open

TPOT error for xgboost multiclass classificaion #1333

kiranellur opened this issue Dec 3, 2023 · 1 comment

Comments

@kiranellur
Copy link

While trying to use Tpot to get the best pipeline I am getting the following error

Invalid classes inferred from unique values of y. Expected: [0 1 2 3 4 5], got [1 2 3 4 5 6]

Context of the issue

I am using the tpot 0.12.1 version and xgboost 2.0.1 version, in place of cv I am providing StratifiedKFold( n_splits=cv_folds, shuffle=False, random_state=params["random_state"] )

My data consists of 6 classes. I am aware of that this error comes due to the different splitting each time (using stratified split), some splits do not have all the labels in both groups. How can i resolve this in tpot?

still I am getting the following error.

Invalid classes inferred from unique values of y. Expected: [0 1 2 3 4 5], got [1 2 3 4 5 6]

Note: I am using label encoding as xgboost 2.0 version does not have in built label encoding.

May I know is there a way to resolve this error?

@perib
Copy link
Contributor

perib commented Dec 3, 2023

This error can happen when you have only one sample for a class. Since the stratifiedkfold doesn't repeat samples, there could be a fold without examples for a particular class. This can be solved by simply removing these classes. It can also happen if the labels are not encoded properly before TPOT.

If you can share a minimum example that reproduces the issue we can take a look

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