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

Issue with using XGBClassifier #262

Open
atifov opened this issue Nov 23, 2021 · 1 comment
Open

Issue with using XGBClassifier #262

atifov opened this issue Nov 23, 2021 · 1 comment

Comments

@atifov
Copy link

atifov commented Nov 23, 2021

When I use XGBClassifier (from XGboost library) using any DES or DCS algorithm, I am getting a features_names mismatch error. I have pooled several other classifiers successfully. This error only arises when Xgboost is included in the pooled classifiers. Moreover I have successfully been able to use XGBoost in the Deslib Stacked Classifier algorithm. Please note as per previous advice, I have installed the latest version (0.3.5) of the library using the code:

pip install git+https://github.com/scikit-learn-contrib/DESlib

Following is the main code:

X_train, X_test, Y_train, Y_test = train_test_split(X, y, test_size=0.2, random_state=0)

classifiers = [LogisticRegression(), RandomForestClassifier(), RUSBoostClassifier(), XGBClassifier(), DecisionTreeClassifier()]

for c in classifiers: c.fit(X_train, Y_train)

model = RRC(pool_classifiers=classifiers, random_state=0)

model.fit(X_train, Y_train)

ValueError: feature_names mismatch:

@Menelau
Copy link
Collaborator

Menelau commented Nov 24, 2021

@atifov thanks for reporting this issue.

Apparently this happens due to a difference in implementation between sklearn ensembles and XGBoost. Let me dig deeper into this issue to come up with a solution to this compatibility problem.

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