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
ca793710
Commit
ca793710
authored
6 years ago
by
Theophile GENTILHOMME
Browse files
Options
Downloads
Patches
Plain Diff
[script][figure] Modify metrics according to measure changes
parent
628f83b0
No related branches found
No related tags found
1 merge request
!167
Various fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/script/figure.py
+32
-9
32 additions, 9 deletions
bob/bio/base/script/figure.py
with
32 additions
and
9 deletions
bob/bio/base/script/figure.py
+
32
−
9
View file @
ca793710
...
@@ -5,10 +5,9 @@ import click
...
@@ -5,10 +5,9 @@ import click
import
matplotlib.pyplot
as
mpl
import
matplotlib.pyplot
as
mpl
import
bob.measure.script.figure
as
measure_figure
import
bob.measure.script.figure
as
measure_figure
import
bob.measure
import
bob.measure
from
bob.measure
import
plot
from
bob.measure
import
(
plot
,
utils
)
from
tabulate
import
tabulate
from
tabulate
import
tabulate
class
Roc
(
measure_figure
.
Roc
):
class
Roc
(
measure_figure
.
Roc
):
def
__init__
(
self
,
ctx
,
scores
,
evaluation
,
func_load
):
def
__init__
(
self
,
ctx
,
scores
,
evaluation
,
func_load
):
super
(
Roc
,
self
).
__init__
(
ctx
,
scores
,
evaluation
,
func_load
)
super
(
Roc
,
self
).
__init__
(
ctx
,
scores
,
evaluation
,
func_load
)
...
@@ -114,6 +113,14 @@ class Dir(measure_figure.PlotBase):
...
@@ -114,6 +113,14 @@ class Dir(measure_figure.PlotBase):
class
Metrics
(
measure_figure
.
Metrics
):
class
Metrics
(
measure_figure
.
Metrics
):
'''
Compute metrics from score files
'''
'''
Compute metrics from score files
'''
def
__init__
(
self
,
ctx
,
scores
,
evaluation
,
func_load
,
names
=
(
'
Failure to Acquire
'
,
'
False Match Rate
'
,
'
False Non Match Rate
'
,
'
False Accept Rate
'
,
'
False Reject Rate
'
,
'
Half Total Error Rate
'
)):
super
(
Metrics
,
self
).
__init__
(
ctx
,
scores
,
evaluation
,
func_load
,
names
)
def
init_process
(
self
):
def
init_process
(
self
):
if
self
.
_criterion
==
'
rr
'
:
if
self
.
_criterion
==
'
rr
'
:
self
.
_thres
=
[
None
]
*
self
.
n_systems
if
self
.
_thres
is
None
else
\
self
.
_thres
=
[
None
]
*
self
.
n_systems
if
self
.
_thres
is
None
else
\
...
@@ -122,7 +129,7 @@ class Metrics(measure_figure.Metrics):
...
@@ -122,7 +129,7 @@ class Metrics(measure_figure.Metrics):
def
compute
(
self
,
idx
,
input_scores
,
input_names
):
def
compute
(
self
,
idx
,
input_scores
,
input_names
):
'''
Compute metrics for the given criteria
'''
'''
Compute metrics for the given criteria
'''
title
=
self
.
_legends
[
idx
]
if
self
.
_legends
is
not
None
else
None
title
=
self
.
_legends
[
idx
]
if
self
.
_legends
is
not
None
else
None
headers
=
[
''
or
title
,
'
Dev
elopment
%s
'
%
input_names
[
0
]]
headers
=
[
''
or
title
,
'
Dev
.
%s
'
%
input_names
[
0
]]
if
self
.
_eval
and
input_scores
[
1
]
is
not
None
:
if
self
.
_eval
and
input_scores
[
1
]
is
not
None
:
headers
.
append
(
'
eval % s
'
%
input_names
[
1
])
headers
.
append
(
'
eval % s
'
%
input_names
[
1
])
if
self
.
_criterion
==
'
rr
'
:
if
self
.
_criterion
==
'
rr
'
:
...
@@ -205,12 +212,28 @@ class Metrics(measure_figure.Metrics):
...
@@ -205,12 +212,28 @@ class Metrics(measure_figure.Metrics):
tabulate
(
raws
,
headers
,
self
.
_tablefmt
),
file
=
self
.
log_file
tabulate
(
raws
,
headers
,
self
.
_tablefmt
),
file
=
self
.
log_file
)
)
else
:
else
:
self
.
names
=
(
title
=
self
.
_legends
[
idx
]
if
self
.
_legends
is
not
None
else
None
'
Failure to Acquire
'
,
'
False Match Rate
'
,
all_metrics
=
self
.
_get_all_metrics
(
idx
,
input_scores
,
input_names
)
'
False Non Match Rate
'
,
'
False Accept Rate
'
,
headers
=
[
'
'
or
title
,
'
Development
'
]
'
False Reject Rate
'
,
'
Half Total Error Rate
'
rows
=
[[
self
.
names
[
0
],
all_metrics
[
0
][
0
]],
)
[
self
.
names
[
1
],
all_metrics
[
0
][
1
]],
super
(
Metrics
,
self
).
compute
(
idx
,
input_scores
,
input_names
)
[
self
.
names
[
2
],
all_metrics
[
0
][
2
]],
[
self
.
names
[
3
],
all_metrics
[
0
][
3
]],
[
self
.
names
[
4
],
all_metrics
[
0
][
4
]],
[
self
.
names
[
5
],
all_metrics
[
0
][
5
]]]
if
self
.
_eval
:
# computes statistics for the eval set based on the threshold a
# priori
headers
.
append
(
'
Evaluation
'
)
rows
[
0
].
append
(
all_metrics
[
1
][
0
])
rows
[
1
].
append
(
all_metrics
[
1
][
1
])
rows
[
2
].
append
(
all_metrics
[
1
][
2
])
rows
[
3
].
append
(
all_metrics
[
1
][
3
])
rows
[
4
].
append
(
all_metrics
[
1
][
4
])
rows
[
5
].
append
(
all_metrics
[
1
][
5
])
click
.
echo
(
tabulate
(
rows
,
headers
,
self
.
_tablefmt
),
file
=
self
.
log_file
)
class
MultiMetrics
(
measure_figure
.
MultiMetrics
):
class
MultiMetrics
(
measure_figure
.
MultiMetrics
):
...
...
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