how to pass categorical features names or indices to learner
#805 opened on Nov 8, 2022
Repository metrics
- Stars
- (4,364 stars)
- PR merge metrics
- (PR metrics pending)
Description
Dear, first of all thanks so much again for You awesome project and support.
I have thought to increase score best learner passing the features categorical information to the learner capable to manage categorical features. I rearrange Your extra argument example:
from flaml.data import load_openml_dataset from flaml import AutoML import numpy as np
X_train, X_test, y_train, y_test = load_openml_dataset(dataset_id=1169, data_dir="./")
cat_feat_index_list = np.where(X_train.dtypes != float) [0]
cat_feat_index_list = cat_feat_index_list.astype(np.int32)
cat_feat_names_list = X_train.iloc[:,cat_feat_index_list].columns.to_list()
automl = AutoML()
automl_settings = {
"task": "classification",
"time_budget": 60,
"estimator_list": "auto",
"fit_kwargs_by_estimator": {
"catboost": {
"cat_features": cat_feat_index_list,
}
},
}
automl.fit(X_train=X_train, y_train=y_train, **automl_settings)
but get the following error:
TypeError: catboost.core.CatBoostClassifier.fit() got multiple values for keyword argument 'cat_features'.
I tried a lot workarounds but nothing.......no way.
Please could You kindly help me.
Thanks in advance.
luigi