如何并排编写准确性和精确值?

发布于 2025-01-20 16:59:07 字数 763 浏览 3 评论 0原文

在此处输入图像描述我如何打印精度,准确性,召回和f1得分值,乘以F1得分值。侧面如图所示?

for name, model in models:
model = model.fit(X_train, Y_train)
Y_pred = model.predict(X_test)
from sklearn import metrics
print("Model -> %s -> \n ACCURACY[enter image description here][1]: %%%.2f" % (name,metrics.accuracy_score(Y_test, Y_pred)*100), end=" -> ")
print("Model -> %s -> PRECISION: %%%.2f" % (name,metrics.precision_score(Y_test, Y_pred)*100,), end=" -> ")
print("Model -> %s -> RECALL: %%%.2f" % (name,metrics.recall_score(Y_test, Y_pred)*100,), end=" -> ")
print("Model -> %s -> F1-SCORE: %%%.2f" % (name,metrics.f1_score(Y_test, Y_pred)*100,))

enter image description hereHow can I print precision, accuracy, recall and f1-score values side by side as shown in the image ?

for name, model in models:
model = model.fit(X_train, Y_train)
Y_pred = model.predict(X_test)
from sklearn import metrics
print("Model -> %s -> \n ACCURACY[enter image description here][1]: %%%.2f" % (name,metrics.accuracy_score(Y_test, Y_pred)*100), end=" -> ")
print("Model -> %s -> PRECISION: %%%.2f" % (name,metrics.precision_score(Y_test, Y_pred)*100,), end=" -> ")
print("Model -> %s -> RECALL: %%%.2f" % (name,metrics.recall_score(Y_test, Y_pred)*100,), end=" -> ")
print("Model -> %s -> F1-SCORE: %%%.2f" % (name,metrics.f1_score(Y_test, Y_pred)*100,))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七禾 2025-01-27 16:59:07

尝试使用格式化字符串文字(也简称为 f 字符串),即前缀中带有 'f' 或 'F' 的字符串文字:

>>> name = 'Oliver'
>>> last_name = 'Mohr'
>>> print(f'My name is {name} {last_name}.')
My name is Oliver Mohr.

一般情况下: 在前面添加 f字符串为f'...',然后在 '' 符号内写入字符串,并在 {} 大括号内添加变量

Try with formatted string literals (also called f-strings for short), that is, string literals with 'f' or 'F' in their prefixes:

>>> name = 'Oliver'
>>> last_name = 'Mohr'
>>> print(f'My name is {name} {last_name}.')
My name is Oliver Mohr.

In general: Add an f before the string as f'...', then you write your string within the '' symbols and add variables within it inside {} braces

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文