每次迭代,火车的损失都在增加。
Iter Train Loss Remaining Time
1 5313.1014 22.51s
2 5170.8669 21.21s
3 1641863.7866 20.05s
4 1640770.5703 18.86s
5 1695332.9514 17.62s
6 1689162.9816 16.42s
7 1689562.3732 15.26s
8 1803110.9519 14.08s
9 1801803.5873 12.94s
10 2274529.9750 11.77s
11 17589338.0388 10.59s
12 1121779686.7875 10.03s
13 1071057062185277527192667544912333682394851905403317706031104.0000
14 1071057062185277527192667544912333682394851905403317706031104.0000
15 1071057062185277527192667544912333682394851905403317706031104.0000
16 1071057062185277527192667544912333682394851905403317706031104.0000
17 1071057062185277527192667544912333682394851905403317706031104.0000
18 1071057062185277527192667544912333682394851905403317706031104.0000
19 1071057062185277527192667544912333682394851905403317706031104.0000
20 1071057062185277527192667544912333682394851905403317706031104.0000
我的输入是一个0s和1s的大矩阵(矢量化词,作为稀疏矩阵),我的目标是整数:
array([131, 64, 64, 134, 32, 50, 42, 154, 124, 29, 64, 154, 137,
64, 64, 64, 89, 16, 125, 64])
也许我的代码有问题,但是我对此表示怀疑。在这里:
xgboost = GradientBoostingClassifier(n_estimators=20,
min_samples_leaf=2,
min_samples_split=3,
verbose=10, max_features=20)
xgboost.fit(xtrain, ytrain)
我的输入形状是:
<1544x19617 sparse matrix of type '<class 'numpy.int64'>'
with 202552 stored elements in Compressed Sparse Row format>
答案 0 :(得分:0)
当训练损失突然爆发时,有时是因为陷入了退化的解决方案空间。降低学习率可能会有所帮助(在这种情况下,可能会有所帮助)。在梯度提升中,学习率会影响每个连续树对现有预测的影响。通过降低学习率,任何一棵树从根本上改变整体预测的能力就会降低,这有助于避免意外地落入退化的解空间。