f1 = f1_score(y_pred, y_test, average='macro') #模型评估准确性、精准度 # 假设 y_true 是真实标签,y_pred 是模型预测标签 print('accuracy %s' % accuracy_score(y_pred, y_test)) print('precision %s' % precision_score(y_pred, y_test, average='weighted') #print('recall %s' % recall_score(y_pred, y_test, average='weighted') print('f1-score %s' % f1_score(y_pred, y_test, average='macro'))报错ivalid syntax
时间: 2023-06-19 22:06:06 浏览: 95
你的代码最后一行缺少右括号,修改后应该是这样的:
```
f1 = f1_score(y_pred, y_test, average='macro') #模型评估准确性、精准度 # 假设 y_true 是真实标签,y_pred 是模型预测标签
print('accuracy %s' % accuracy_score(y_pred, y_test))
print('precision %s' % precision_score(y_pred, y_test, average='weighted'))
#print('recall %s' % recall_score(y_pred, y_test, average='weighted'))
print('f1-score %s' % f1)
```
阅读全文