微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么模型的分数与我的 XGBoost 模型中的 f1 分数不同

如何解决为什么模型的分数与我的 XGBoost 模型中的 f1 分数不同

我使用 Python 3 中的 XGBoost 库创建了一个梯度提升模型。该模型是针对特定电信数据集的分类模型。

结果如下。

searching domain
{"learning_rate"    : [0.05,0.10],"max_depth"        : [ 5,6,8],"min_child_weight" : [ 1,3,5],"gamma"            : [0.1],"colsample_bytree" : [ 0.3,0.4 ],"n_estimators"     : [10,9],"objective"        : ['binary:logistic'],"eval_metric"      : ['error']}

Best score: 0.846148908841385
Best arguments: {'colsample_bytree': 0.4,'eval_metric': 'error','gamma': 0.1,'learning_rate': 0.05,'max_depth': 6,'min_child_weight': 1,'n_estimators': 10,'objective': 'binary:logistic'}

score on train data: 0.8805998860989313
score on test data: 0.8364520807988984

confusion matrix
[[1417  107]
 [ 329  260]]

 y_test to y_pred roc_crv
               precision    recall  f1-score   support

           0       0.81      0.93      0.87      1524
           1       0.71      0.44      0.54       589

    accuracy                           0.79      2113
   macro avg       0.76      0.69      0.71      2113
weighted avg       0.78      0.79      0.78      2113

img


但我不明白为什么 f1 分数与测试数据集的分数不同。为什么会出现这种差异?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。