Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.base
Commits
55f3a558
Verified
Commit
55f3a558
authored
1 year ago
by
Yannick DAYER
Browse files
Options
Downloads
Patches
Plain Diff
feat: add "score-column" to the bob bio commands.
parent
dd1b3293
No related branches found
No related tags found
1 merge request
!325
feat: add an option to select the score column in the bob bio measure commands
Pipeline
#75586
failed
1 year ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bob/bio/base/script/commands.py
+104
-12
104 additions, 12 deletions
src/bob/bio/base/script/commands.py
with
104 additions
and
12 deletions
src/bob/bio/base/script/commands.py
+
104
−
12
View file @
55f3a558
...
@@ -69,7 +69,12 @@ def rank_option(**kwargs):
...
@@ -69,7 +69,12 @@ def rank_option(**kwargs):
)
)
def
metrics
(
ctx
,
scores
,
evaluation
,
score_column
,
**
kwargs
):
def
metrics
(
ctx
,
scores
,
evaluation
,
score_column
,
**
kwargs
):
if
"
criterion
"
in
ctx
.
meta
and
ctx
.
meta
[
"
criterion
"
]
==
"
rr
"
:
if
"
criterion
"
in
ctx
.
meta
and
ctx
.
meta
[
"
criterion
"
]
==
"
rr
"
:
process
=
bio_figure
.
Metrics
(
ctx
,
scores
,
evaluation
,
load
.
cmc
)
process
=
bio_figure
.
Metrics
(
ctx
,
scores
,
evaluation
,
functools
.
partial
(
load
.
cmc
,
csv_score_column
=
score_column
),
)
else
:
else
:
process
=
bio_figure
.
Metrics
(
process
=
bio_figure
.
Metrics
(
ctx
,
ctx
,
...
@@ -85,8 +90,22 @@ def metrics(ctx, scores, evaluation, score_column, **kwargs):
...
@@ -85,8 +90,22 @@ def metrics(ctx, scores, evaluation, score_column, **kwargs):
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio roc
"
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio roc
"
)
)
)
)
def
roc
(
ctx
,
scores
,
evaluation
,
**
kwargs
):
@click.option
(
process
=
bio_figure
.
Roc
(
ctx
,
scores
,
evaluation
,
load
.
split
)
"
--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
roc
(
ctx
,
scores
,
evaluation
,
score_column
,
**
kwargs
):
process
=
bio_figure
.
Roc
(
ctx
,
scores
,
evaluation
,
functools
.
partial
(
load
.
split
,
csv_score_column
=
score_column
),
)
process
.
run
()
process
.
run
()
...
@@ -95,8 +114,22 @@ def roc(ctx, scores, evaluation, **kwargs):
...
@@ -95,8 +114,22 @@ def roc(ctx, scores, evaluation, **kwargs):
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio det
"
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio det
"
)
)
)
)
def
det
(
ctx
,
scores
,
evaluation
,
**
kwargs
):
@click.option
(
process
=
bio_figure
.
Det
(
ctx
,
scores
,
evaluation
,
load
.
split
)
"
--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
det
(
ctx
,
scores
,
evaluation
,
score_column
,
**
kwargs
):
process
=
bio_figure
.
Det
(
ctx
,
scores
,
evaluation
,
functools
.
partial
(
load
.
split
,
csv_score_column
=
score_column
),
)
process
.
run
()
process
.
run
()
...
@@ -105,8 +138,22 @@ def det(ctx, scores, evaluation, **kwargs):
...
@@ -105,8 +138,22 @@ def det(ctx, scores, evaluation, **kwargs):
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio epc
"
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio epc
"
)
)
)
)
def
epc
(
ctx
,
scores
,
**
kwargs
):
@click.option
(
process
=
measure_figure
.
Epc
(
ctx
,
scores
,
True
,
load
.
split
)
"
--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
epc
(
ctx
,
scores
,
score_column
,
**
kwargs
):
process
=
measure_figure
.
Epc
(
ctx
,
scores
,
True
,
functools
.
partial
(
load
.
split
,
csv_score_column
=
score_column
),
)
process
.
run
()
process
.
run
()
...
@@ -115,8 +162,22 @@ def epc(ctx, scores, **kwargs):
...
@@ -115,8 +162,22 @@ def epc(ctx, scores, **kwargs):
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio hist
"
score_format
=
SCORE_FORMAT
,
command
=
"
bob bio hist
"
)
)
)
)
def
hist
(
ctx
,
scores
,
evaluation
,
**
kwargs
):
@click.option
(
process
=
bio_figure
.
Hist
(
ctx
,
scores
,
evaluation
,
load
.
split
)
"
--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
hist
(
ctx
,
scores
,
evaluation
,
score_column
,
**
kwargs
):
process
=
bio_figure
.
Hist
(
ctx
,
scores
,
evaluation
,
functools
.
partial
(
load
.
split
,
csv_score_column
=
score_column
),
)
process
.
run
()
process
.
run
()
...
@@ -126,8 +187,23 @@ def hist(ctx, scores, evaluation, **kwargs):
...
@@ -126,8 +187,23 @@ def hist(ctx, scores, evaluation, **kwargs):
),
),
criteria
=
CRITERIA
,
criteria
=
CRITERIA
,
)
)
@click.option
(
"
--score-column
"
,
default
=
"
score
"
,
show_default
=
True
,
help
=
(
"
NOT YET IMPLEMENTED.
"
"
Selects the CSV column to consider as scores. This is ignored for
"
"
non-CSV files. The column must contain numerical values.
"
),
)
@common_options.cost_option
()
@common_options.cost_option
()
def
evaluate
(
ctx
,
scores
,
evaluation
,
**
kwargs
):
def
evaluate
(
ctx
,
scores
,
evaluation
,
score_column
,
**
kwargs
):
if
score_column
!=
"
score
"
:
raise
NotImplementedError
(
"'
evaluate
'
does not yet support files with scores in columns
"
"
other than
'
score
'
.
"
)
common_options
.
evaluate_flow
(
common_options
.
evaluate_flow
(
ctx
,
scores
,
evaluation
,
metrics
,
roc
,
det
,
epc
,
hist
,
**
kwargs
ctx
,
scores
,
evaluation
,
metrics
,
roc
,
det
,
epc
,
hist
,
**
kwargs
)
)
...
@@ -142,9 +218,25 @@ def evaluate(ctx, scores, evaluation, **kwargs):
...
@@ -142,9 +218,25 @@ def evaluate(ctx, scores, evaluation, **kwargs):
),
),
criteria
=
CRITERIA
,
criteria
=
CRITERIA
,
)
)
def
multi_metrics
(
ctx
,
scores
,
evaluation
,
protocols_number
,
**
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
multi_metrics
(
ctx
,
scores
,
evaluation
,
protocols_number
,
score_column
,
**
kwargs
):
ctx
.
meta
[
"
min_arg
"
]
=
protocols_number
*
(
2
if
evaluation
else
1
)
ctx
.
meta
[
"
min_arg
"
]
=
protocols_number
*
(
2
if
evaluation
else
1
)
process
=
bio_figure
.
MultiMetrics
(
ctx
,
scores
,
evaluation
,
load
.
split
)
process
=
bio_figure
.
MultiMetrics
(
ctx
,
scores
,
evaluation
,
functools
.
partial
(
load
.
split
,
csv_score_column
=
score_column
),
)
process
.
run
()
process
.
run
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment