From dd1b3293938652dd48aa5395afe920aa13171ff7 Mon Sep 17 00:00:00 2001 From: Yannick DAYER <yannick.dayer@idiap.ch> Date: Wed, 5 Jul 2023 11:38:48 +0200 Subject: [PATCH] feat: add a score-column option to bob bio metrics --- src/bob/bio/base/script/commands.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/bob/bio/base/script/commands.py b/src/bob/bio/base/script/commands.py index c5a20f5d..6fc8926f 100644 --- a/src/bob/bio/base/script/commands.py +++ b/src/bob/bio/base/script/commands.py @@ -1,4 +1,5 @@ """ Click commands for ``bob.bio.base`` """ +import functools import logging import click @@ -57,11 +58,25 @@ def rank_option(**kwargs): criteria=CRITERIA, ) @common_options.cost_option() -def metrics(ctx, scores, evaluation, **kwargs): +@click.option( + "--score-column", + default="score", + show_default=True, + help=( + "Selects the CSV column to consider as scores. This is ignored for " + "non-CSV files. The column must contain numerical values." + ), +) +def metrics(ctx, scores, evaluation, score_column, **kwargs): if "criterion" in ctx.meta and ctx.meta["criterion"] == "rr": process = bio_figure.Metrics(ctx, scores, evaluation, load.cmc) else: - process = bio_figure.Metrics(ctx, scores, evaluation, load.split) + process = bio_figure.Metrics( + ctx, + scores, + evaluation, + functools.partial(load.split, csv_score_column=score_column), + ) process.run() -- GitLab