我在 mac (Python 3.6.3 | Anaconda) 中使用 catboost ,但模块cv(version = catboost-0.10.4.1 enum34-1.1.6)
出现了一些问题(使用池的 cat_features 参数)。这是一个例子:
1) 一次性使用 catboost:
from catboost import CatBoostClassifier, cv,
model = CatBoostClassifier(early_stopping_rounds=30,cat_features = [0,1,2,3,4,5,6,7,8],iterations=2000,eval_metric='AUC',learning_rate=0.1,)
model.fit(X_train, y_train,eval_set=(X_test,y_test))
一切正常,我得到了输出!
2-) 当我尝试对 cv 模块使用基本相同的东西时,会出现问题:
cv_data = cv(pool=Pool(X_train, y_train,cat_features = [0,1,2,3,4,5,6,7,8]),params=model.get_params())
输出 :
---------------------------------------------------------------------------
CatboostError Traceback (most recent call last)
<ipython-input-242-675cf317e148> in <module>()
----> 1 cv_data = cv(pool=Pool(X_train, y_train,cat_features=[0,1,2,3,4,5,6,7,8]),params=model.get_params())
~/anaconda3/lib/python3.6/site-packages/catboost/core.py in cv(pool, params, dtrain, iterations, num_boost_round, fold_count, nfold, inverted, partition_random_seed, seed, shuffle, logging_level, stratified, as_pandas, metric_period, verbose, verbose_eval, plot, early_stopping_rounds, save_snapshot, snapshot_file, snapshot_interval)
2900
2901 with log_fixup(), plot_wrapper(plot, params):
-> 2902 return _cv(params, pool, fold_count, inverted, partition_random_seed, shuffle, stratified, as_pandas)
2903
2904
_catboost.pyx in _catboost._cv()
_catboost.pyx in _catboost._cv()
CatboostError: catboost/libs/options/plain_options_helper.cpp:272: Error: unknown option cat_features with value [0,1,2,3,4,5,6,7,8]
这些索引适用于分类变量(并且适用于单一拟合)。
我无法理解发生了什么,也找不到相关内容。有人可以帮忙吗?