python - 参数:{ scale_pos_weight } 可能不会被使用
问题描述
我正在处理这个警告:
[20:16:09] WARNING: ../src/learner.cc:541:
Parameters: { scale_pos_weight } 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.
在 Python 中训练 XGBoost 时。
我一直在研究它,这是由于分类类型(二进制或多类)。问题是我正在对不平衡数据(6483252 负 / 70659 正)进行二进制分类,所以我需要设置该参数以便在训练期间考虑这种不平衡,但我不明白为什么我会收到那个警告:(
这就是我初始化和训练 XGBoost 的方式:
param = {'n_jobs':-1, 'random_state':5, 'booster':'gbtree', 'seed':5, 'objective': 'binary:hinge', 'scale_pos_weight':ratio}
param['eval_metric'] = ['auc', 'aucpr', 'rmse', 'error']
xgb_clf =xgb.XGBClassifier(**param)
xgb_clf.fit(dtrain,y_train)
dtrain 是熊猫数据框,y_train 是带有标签 (0,1) 的熊猫系列。
谢谢!
解决方案
可能的修复是2:
- 您的训练集是多类的,然后参数无效。
- 实现中的 n_jobs 问题(将 n_jobs 设置为 0)
这是最常见的问题
推荐阅读
- python-2.7 - 将带有时区的日期时间对象转换为分钟
- pandas - 为什么使用 pandas 时 cmd 出现语法错误?这段代码有什么问题-
- java - 将两个类相互连接
- javascript - 保存上下文
- javascript - React-dates 如何识别用户选择数据的方式
- javascript - css关键帧动画反转
- java - 某些曲线的 Java 区域构造函数挂起
- google-apps-script - 在 Google Apps 脚本中获取用户 ID
- jquery - 如何在打印时间的中心做数据表标题..?
- machine-learning - 强化学习:处理不可量化的反馈系统