【发布时间】:2020-08-20 04:20:56
【问题描述】:
我已经使用 XGboost 和 PySpark 训练了一个模型
params = {
'eta': 0.1,
'gamma': 0.1,
'missing': 0.0,
'treeMethod': 'gpu_hist',
'maxDepth': 10,
'maxLeaves': 256,
'growPolicy': 'depthwise',
'objective': 'binary:logistic',
'minChildWeight': 30.0,
'lambda_': 1.0,
'scalePosWeight': 2.0,
'subsample': 1.0,
'nthread': 1,
'numRound': 100,
'numWorkers': 1,
}
classifier = XGBoostClassifier(**params).setLabelCol(label).setFeaturesCols(features)
model = classifier.fit(train_data)
当我尝试使用
获得特征重要性时model.nativeBooster.getFeatureScore()
它返回以下错误:
Py4JError: An error occurred while calling o2167.getFeatureScore. Trace:
py4j.Py4JException: Method getFeatureScore([]) does not exist
在将 XGboost 与 PySpark 结合使用时,是否有正确的方法来获取特征重要性
【问题讨论】:
标签: apache-spark pyspark xgboost