microsoft/FLAML

how to pass categorical features names or indices to learner

Open

#805 geöffnet am 8. Nov. 2022

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Jupyter Notebook (560 Forks)github user discovery
good first issuequestion

Repository-Metriken

Stars
 (4.364 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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

Contributor Guide