cm_rfgs = confusion_matrix(y_test, y_had_rfgs) # 显示混淆矩阵 plt.figure(figsize=(4, 4)) plt.title("Random Forest (Best Score) Confusion Matrix")#随机森林(最优参数)混淆矩阵 sns.heatmap(cm_rfgs, annot=True, cmap="Blues", fmt="d", cbar=False)