bdt_gs.fit(X_train, y_train) # 拟合模型 bdt_gs = bdt_gs.best_estimator_ # 最佳模型 y_pred = bdt.predict(X_test) # 进行预测 print("决策树Bagging测试准确率: {:.2f}%".format(bdt_gs.score(X_test, y_test)*100)) print("决策树Bagging测试F1分数: {:.2f}%".format(f1_score(y_test, y_pred)*100))