我是一个专注于机器学习的学生,我对认证感兴趣。我对你们的图书馆感兴趣,因为我想计算EER。
很抱歉问这个基本的问题,但是请告诉我关于bob.measure.load.split()的事情。
在认为第一列是正确的标签,第二列是模型的预测分数时,这种格式所要求的文件格式是否正确?
喜欢
# file.txt
|label|prob |
| -1 | 0.3 |
| 1 | 0.5 |
| -1 | 0.8 |..。
另外,要实际计算EER,我应该遵循以下步骤吗?
neg, pos = bob.measure.load.split('file.txt')
eer = bob.measure.eer(neg, pos)真心的。
发布于 2020-05-12 13:19:04
您有两个使用bob.measure计算EER的选项:
。
使用Python
首先,您需要将分数加载到内存中,并将其分为正负分数。例如:
import numpy as np
import bob.measure
positives = np.array([0.5, 0.5, 0.6, 0.7, 0.2])
negatives = np.array([0.0, 0.0, 0.6, 0.2, 0.2])
eer = bob.measure.eer(negatives, positives)
print(eer)这将打印0.2。所有你需要注意的是,你的正面比较分数高于消极比较。也就是说,对于阳性样本,你的模型得分应该更高。
使用命令行
bob.measure还附带了一套命令行命令,可以帮助您获得错误率。要使用命令行,需要将分数保存在文本文件中。该文件由两列组成,其中列由空间分隔。例如,同一示例的得分文件为:
$ cat scores.txt
1 0.5
1 0.5
1 0.6
1 0.7
1 0.2
-1 0.0
-1 0.0
-1 0.6
-1 0.2
-1 0.2然后你会打电话
$ bob measure metrics scores.txt
[Min. criterion: EER ] Threshold on Development set `scores.txt`: 3.500000e-01
================================ =============
.. Development
================================ =============
False Positive Rate 20.0% (1/5)
False Negative Rate 20.0% (1/5)
Precision 0.8
Recall 0.8
F1-score 0.8
Area Under ROC Curve 0.8
Area Under ROC Curve (log scale) 0.7
================================ =============好的,它没有准确地打印EER,但是打印了EER = (FPR+FNR)/2。
使用bob.bio.base命令行
如果你的分数是一个生物识别实验的结果,那么你想要保存你的分数在4或5列格式的bob.bio.base。请参阅https://gitlab.idiap.ch/bob/bob.bio.base/-/blob/3efccd3b637ee73ec68ed0ac5fde2667a943bd6e/bob/bio/base/test/data/dev-4col.txt中的一个示例和https://www.idiap.ch/software/bob/docs/bob/bob.bio.base/stable/experiments.html#evaluating-experiments中的文档,然后调用bob bio metrics scores-4-col.txt获取与生物特征相关的度量。
https://stackoverflow.com/questions/61747344
复制相似问题