y_pred = np.where(y_prob > 0.2, 1, 0) # 进行阈值调整 cm = confusion_matrix(y_pred, y_test) print('Confusion matrix:\n', cm, '\n') print(classification_report(y_pred, y_test))