microsoft/FLAML

how to pass categorical features names or indices to learner

Open

#805 创建于 2022年11月8日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)Jupyter Notebook (560 fork)github user discovery
good first issuequestion

仓库指标

Star
 (4,364 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南