ext_gs.fit(X_train, y_train) # 拟合模型 ext_gs = ext_gs.best_estimator_ # 最佳模型 y_pred = ext_gs.predict(X_test) # 进行预测 print("极端随机森林测试准确率: {:.2f}%".format(ext_gs.score(X_test, y_test)*100)) print("极端随机森林测试F1分数: {:.2f}%".format(f1_score(y_test, y_pred)*100))