我训练我的 XGBoostClassifier()。如果我的测试集有:
0: 100
1: 884
它试图预测 210 个 1。大约 147 个错误(假阳性)和 63 个正确预测的 1(真阳性)。
然后我增加我的测试样本:
0: 15,000
1: 884
它试图预测 56 个 1。大约 40 个是错误的(假阳性),16 个 1 是正确预测的(真阳性)。
我错过了什么吗?一些理论?关于如何使用的一些指示model.predict(X_test)?
它是否在某处说 - 如果您尝试预测 10 个项目会比您尝试预测 10000 个项目更努力?model.predict(X_test)如果乔·史密斯的预测伴随着多 8000 行,在什么情况下会给我一个不同的结果?
我使用的代码如下:
from xgboost import XGBClassifier
xgb = XGBClassifier(subsample=0.75,scale_post_weight=30,min_child_weight=1,max_depth=3,gamma=5,colsample_bytree=0.75)
model = xgb.fit(X_train,y_train)
y_pred_output = model.predict(X_test)
cm = confusion_matrix(y_test, y_pred_output)
y_pred_output2 = model.predict(X_test2) #contains the same 884 1's plus 14500 more rows with 0's as the target value
cm = confusion_matrix(y_test2, y_pred_output2)
它产生两个不同的矩阵:
#Confusion matrix for y_test with 15000 0's and 884 1's
[[14864 136]
[ 837 47]]
#Confusion matrix for y_test with 500 0's and 884 1's
[[459 41]
[681 203]]
请注意,两次尝试都使用了相同的 884 个肯定类项目。为什么仅仅因为我们现在在 X_test 上有更多的负数,真正的正数会下降到 47?