#用XGboost运行泰坦尼克数据,对max_depth进行调优报错 Check failed: param_.max_depth > 0 (0 vs. 0) : exact tree method doesn't support unlimited depth.
#对max_depth进行调优
depth_range = range(10)
score = []
for i in depth_range:
xg = XGBClassifier(eta=1, gamma=0, max_depth=i)
xg.fit(x_train, y_train)
s = xg.score(x_test, y_test)
print(s)
score.append(s)