from sklearn.metrics import classification_report # 导入分类报告 y_pred = ann.predict(X_test, batch_size=10) # 预测测试集的标签 y_pred = np.round(y_pred) # 四舍五入, 将分类概率值转换成0/1整数值 y_test = y_test.values # 把Pandas series转换成Num Py array y_test = y_test.reshape((len(y_test), 1)) # 转换成与y_pred相同的形状 print(classification_report(y_test, y_pred, labels=[0, 1])) #调用分类报告