commands.py 1.95 KB
Newer Older
1 2 3 4 5 6 7
''' Click commands for ``bob.measure`` '''

from .. import load
from . import figure
from . import common_options


8 9
SCORE_FORMAT = (
    "The command takes as input generic 2-column data format as "
10
    "specified in the documentation of "":py:func:`bob.measure.load.split`.")
11
CRITERIA = ('eer', 'min-hter', 'far')
12 13


14 15 16 17 18
@common_options.metrics_command(common_options.METRICS_HELP.format(
    names='FtA, FAR, FRR, FMR, FMNR, HTER',
    criteria=CRITERIA, score_format=SCORE_FORMAT,
    command='bob measure metrics'), criteria=CRITERIA)
def metrics(ctx, scores, evaluation, **kwargs):
19
    process = figure.Metrics(ctx, scores, evaluation, load.split)
20 21
    process.run()

Amir MOHAMMADI's avatar
lint  
Amir MOHAMMADI committed
22

23 24 25
@common_options.roc_command(
    common_options.ROC_HELP.format(
        score_format=SCORE_FORMAT, command='bob measure roc'))
26
def roc(ctx, scores, evaluation, **kwargs):
27
    process = figure.Roc(ctx, scores, evaluation, load.split)
28 29
    process.run()

Amir MOHAMMADI's avatar
lint  
Amir MOHAMMADI committed
30

31 32 33
@common_options.det_command(
    common_options.DET_HELP.format(
        score_format=SCORE_FORMAT, command='bob measure det'))
34
def det(ctx, scores, evaluation, **kwargs):
35
    process = figure.Det(ctx, scores, evaluation, load.split)
36 37
    process.run()

Amir MOHAMMADI's avatar
lint  
Amir MOHAMMADI committed
38

39 40 41
@common_options.epc_command(
    common_options.EPC_HELP.format(
        score_format=SCORE_FORMAT, command='bob measure epc'))
42
def epc(ctx, scores, **kwargs):
43
    process = figure.Epc(ctx, scores, True, load.split)
44 45
    process.run()

Amir MOHAMMADI's avatar
lint  
Amir MOHAMMADI committed
46

47 48 49
@common_options.hist_command(
    common_options.HIST_HELP.format(
        score_format=SCORE_FORMAT, command='bob measure hist'))
50
def hist(ctx, scores, evaluation, **kwargs):
51
    process = figure.Hist(ctx, scores, evaluation, load.split)
52 53
    process.run()

Amir MOHAMMADI's avatar
lint  
Amir MOHAMMADI committed
54

55 56 57 58
@common_options.evaluate_command(
    common_options.EVALUATE_HELP.format(
        score_format=SCORE_FORMAT, command='bob measure evaluate'),
    criteria=CRITERIA)
59
def evaluate(ctx, scores, evaluation, **kwargs):
60 61
    common_options.evaluate_flow(
        ctx, scores, evaluation, metrics, roc, det, epc, hist, **kwargs)