Commit dc4ae0fe authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Fix a bug when neg and pos scores were swapped and nit

parent a2640f7d
Pipeline #19759 failed with stage
in 102 minutes and 48 seconds
'''Runs error analysis on score sets, outputs metrics and plots''' '''Runs error analysis on score sets, outputs metrics and plots'''
import pkg_resources # to make sure bob gets imported properly
import logging import logging
import click import click
import numpy as np import numpy as np
...@@ -147,7 +146,7 @@ class HistVuln(measure_figure.Hist): ...@@ -147,7 +146,7 @@ class HistVuln(measure_figure.Hist):
def _setup_hist(self, neg, pos): def _setup_hist(self, neg, pos):
self._title_base = 'Vulnerability' self._title_base = 'Vulnerability'
self._density_hist( self._density_hist(
pos[0], n=0, label='Genuine', color='C1' pos[0], n=0, label='Genuine', color='C2'
) )
self._density_hist( self._density_hist(
neg[0], n=1, label='Zero-effort impostors', alpha=0.8, color='C0' neg[0], n=1, label='Zero-effort impostors', alpha=0.8, color='C0'
...@@ -172,7 +171,7 @@ class HistVuln(measure_figure.Hist): ...@@ -172,7 +171,7 @@ class HistVuln(measure_figure.Hist):
far, frr = farfrr(neg[0], pos[0], threshold) far, frr = farfrr(neg[0], pos[0], threshold)
_iapmr_plot(neg[1], threshold, iapmr, real_data=real_data) _iapmr_plot(neg[1], threshold, iapmr, real_data=real_data)
click.echo( click.echo(
'%s (t=%.2g) = %.2f%%; IAPMR = %.2f%%' % ( '%s (threshold=%.2g) = %.2f%%; IAPMR = %.2f%%' % (
self._criterion.upper(), self._criterion.upper(),
threshold, threshold,
50*(far+frr), 100*iapmr 50*(far+frr), 100*iapmr
......
"""Generate random scores. """Generate random scores.
""" """
import pkg_resources # to make sure bob gets imported properly
import os import os
import logging import logging
import numpy import numpy
...@@ -16,6 +15,7 @@ NUM_GENUINE_ACCESS = 5000 ...@@ -16,6 +15,7 @@ NUM_GENUINE_ACCESS = 5000
NUM_ZEIMPOSTORS = 5000 NUM_ZEIMPOSTORS = 5000
NUM_PA = 5000 NUM_PA = 5000
def gen_score_distr(mean_gen, mean_zei, mean_pa, sigma_gen=1, sigma_zei=1, def gen_score_distr(mean_gen, mean_zei, mean_pa, sigma_gen=1, sigma_zei=1,
sigma_pa=1): sigma_pa=1):
mt = random.mt19937() # initialise the random number generator mt = random.mt19937() # initialise the random number generator
...@@ -31,16 +31,16 @@ def gen_score_distr(mean_gen, mean_zei, mean_pa, sigma_gen=1, sigma_zei=1, ...@@ -31,16 +31,16 @@ def gen_score_distr(mean_gen, mean_zei, mean_pa, sigma_gen=1, sigma_zei=1,
return genuine_scores, zei_scores, pa_scores return genuine_scores, zei_scores, pa_scores
def write_scores_to_file(pos, neg, filename, attack=False): def write_scores_to_file(neg, pos, filename, attack=False):
"""Writes score distributions into 4-column score files. For the format of """Writes score distributions into 4-column score files. For the format of
the 4-column score files, please refer to Bob's documentation. the 4-column score files, please refer to Bob's documentation.
Parameters Parameters
---------- ----------
pos : array_like
Scores for positive samples.
neg : array_like neg : array_like
Scores for negative samples. Scores for negative samples.
pos : array_like
Scores for positive samples.
filename : str filename : str
The path to write the score to. The path to write the score to.
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment