Python XGBoost GPU 版本的精度低于 CPU 版本 - 参数调整
Python XGBoost GPU version underperforming accuracy of CPU version - parameters tuning
我正在使用 XGBoost 开发欺诈检测模型。
我无法共享数据(抱歉)
基于 CPU 的模型运行良好,并按预期识别欺诈。
基于 GPU 的模型识别出的欺诈数量较少。
因此,在相同的置信度下,基于 GPU 的模型识别出的欺诈数量要少得多。
这是 CPU 的参数列表:
params = {"objective":"multi:softprob",
'booster':'dart',
'max_depth':5,
'eta':0.1,
'subsample':0.2,
'nthread':mp.cpu_count()-1,
'eval_metric':'merror',
'colsample_bytree':0.2,
'num_class':2}
GPU模型训练参数为:
params = {"objective":"multi:softprob",
'subsample':0.2,
'gpu_id':0,
'num_class':2,
'tree_method':'gpu_hist',
'max_depth':5,
'eta':0.1,
'gamma':1100,
'eval_metric':'mlogloss'}
这是由于使用了不同的“树”参数。很可能它在使用 CPU 时使用 tree_method='exact'
,因为您没有明确给出树参数。您可以通过将 tree_method='exact'
添加到您的 CPU 参数列表来测试它,并检查您是否获得了与没有它时一样好的准确性。但是您在使用 GPU 时使用 tree_method='gpu_hist'
。您可以在 here
找到有关所有树方法的更多信息
我正在使用 XGBoost 开发欺诈检测模型。
我无法共享数据(抱歉)
基于 CPU 的模型运行良好,并按预期识别欺诈。
基于 GPU 的模型识别出的欺诈数量较少。
因此,在相同的置信度下,基于 GPU 的模型识别出的欺诈数量要少得多。
这是 CPU 的参数列表:
params = {"objective":"multi:softprob",
'booster':'dart',
'max_depth':5,
'eta':0.1,
'subsample':0.2,
'nthread':mp.cpu_count()-1,
'eval_metric':'merror',
'colsample_bytree':0.2,
'num_class':2}
GPU模型训练参数为:
params = {"objective":"multi:softprob",
'subsample':0.2,
'gpu_id':0,
'num_class':2,
'tree_method':'gpu_hist',
'max_depth':5,
'eta':0.1,
'gamma':1100,
'eval_metric':'mlogloss'}
这是由于使用了不同的“树”参数。很可能它在使用 CPU 时使用 tree_method='exact'
,因为您没有明确给出树参数。您可以通过将 tree_method='exact'
添加到您的 CPU 参数列表来测试它,并检查您是否获得了与没有它时一样好的准确性。但是您在使用 GPU 时使用 tree_method='gpu_hist'
。您可以在 here