Parameters: { "feature_types" } might not be used

I get this error

Parameters: { "feature_types" } might not be used.

  This may not be accurate due to some parameters are only used in language bindings but
  passed down to XGBoost core.  Or some parameters are not used but slip through this
  verification. Please open an issue if you find above cases.

Here the code to reproduce it

import numpy as np
import pandas as pd
from xgboost import XGBClassifier

bool_target = pd.DataFrame(
    {
        "target": np.random.choice(a=[False, True], size=1000),
        "random": np.random.uniform(size=1000), # add something random
        "cate" : np.random.randint(0,3, size=1000),
    }
)

# for each value. make sure there is a 90% match rate
bool_target["explanatory"] = np.where(np.random.uniform(size=1000) < 0.1, ~bool_target.target, bool_target.target)

X, y = bool_target.iloc[:, [1,2, 3]], bool_target.iloc[:, [0]]

m = XGBClassifier(
    n_jobs=1,
    use_label_encoder=False,
    objective="binary:logistic",
    feature_types = ['float', 'int', 'i'],
    # enable_categorical=True,
    eval_metric="auc").fit(X, y)

So what’s wrong here? How do I specify int types and bool types?

Categorical data support is currently being developed and is not yet available in XGBClassifier. You have two options:

  • Use xgb.train() instead. In this case, you can set enable_categorical and feature_types in the DMatrix constructor. OR
  • Convert categorical features into dummy binary variables using one-hot encoding.
1 Like

so the issue is just the XGBClassifier scikit learn interface interface

Also that categorical data support is still experimental.