【问题标题】:print function shifts the output resultprint 函数移动输出结果
【发布时间】:2021-10-31 09:51:55
【问题描述】:

我不知道标题中是否明确,但我想打印一个classification_report

我想写它属于Test set,就像这样:

print(f'Test classification report :{classification_report(y_test, y_pred)}')

但它给出的输出是 4 列名称移位:

Test classification report :              precision    recall  f1-score   support

           0       0.68      0.50      0.57       187
           1       0.79      0.89      0.84       407

    accuracy                           0.77       594
   macro avg       0.74      0.69      0.71       594
weighted avg       0.76      0.77      0.76       594

谢谢

【问题讨论】:

  • print(f'Test classification report :\nclassification_report(y_test, y_pred)}') - 注意\n - 将在新行上打印标题。这就是你想要的吗?
  • @tdelaney 好的,谢谢!

标签: python pandas numpy scikit-learn metrics


【解决方案1】:

\n 是要走的路 它添加了一个新行

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-13
    • 2013-01-28
    • 2014-07-06
    • 1970-01-01
    • 2016-02-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多