有没有办法在拥抱面部训练师的拥抱面孔中打电话给宏观精神?

发布于 2025-02-13 22:18:35 字数 171 浏览 1 评论 0原文

目前,我正在使用拥抱面模型在Feft-2015数据集上进行测试。我想将我的结果与已完成的结果进行比较。

我从数据集库中检查了list_metrics方法,但我没有看到宏观精度,这是研究人员当时使用的指标。

您有任何迹象表明我如何解决这个问题吗?

I'm currently making tests on the DEFT-2015 dataset using Hugging Face models. I would like to compare my results to what has been done.

I checked in the list_metrics method from the datasets library, but I did not see Macro Precision, which was the metric used at the time by the researchers.

Do you have any indication for how I could tackle the problem ?

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

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

发布评论

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

评论(1

入怼 2025-02-20 22:18:35

huggingface library(版本4.20.0)似乎取决于Scikit-Learn库的窗帘呼叫后面。

如果您只使用(不使用scikit-learn):

from datasets import load_metric
metric = load_metric("precision")
precision = metric.compute(predictions=[...],references=[...]) 

它将抛出一个错误

scikit-learn未安装。

为什么此简介?

好吧,实际上,您可以轻松地使用数据集指标来计算您的指标(就像Scikit-Learn一样)。

您只需要添加“平均”参数:

  from datasets import load_metric
  metric = load_metric("precision")
  precision = metric.compute(predictions = [0, 0, 0, 0, 1, 1, 2, 2],
                             references  = [0, 0, 0, 0, 1, 1, 1, 2],
                             average='macro')
  # This prints 0.833333334
  print(precision)

上面的摘要将打印{'precision':0.833333333333333334},因为(1 + 1 + 1 + 1 + 1 + 0.5)/3 = 0.83 = 0.83 ,这正是您要搜索的宏观精度的定义。

结论:使用平均参数设置您要计算度量的方式(Micro/Macro/加权)。

The huggingface library (version 4.20.0) seems to depend behind the curtains calls to scikit-learn library.

If you just use (without using scikit-learn):

from datasets import load_metric
metric = load_metric("precision")
precision = metric.compute(predictions=[...],references=[...]) 

it will throw an error that

scikit-learn is not installed.

Why this intro?

Well, in fact, you can easily use datasets metrics to calculate however you want your metric (just exactly like scikit-learn does).

You just need to add the 'average' parameter:

  from datasets import load_metric
  metric = load_metric("precision")
  precision = metric.compute(predictions = [0, 0, 0, 0, 1, 1, 2, 2],
                             references  = [0, 0, 0, 0, 1, 1, 1, 2],
                             average='macro')
  # This prints 0.833333334
  print(precision)

The snippet above will print {'precision': 0.8333333333333334}, because (1 + 1 + 0.5) / 3 = 0.83, which is exactly the definition of macro precision you are searching for.

Conclusion : Use the average parameter to set the way you want to calculate your metric (micro/macro/weighted).

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