Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.measure
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.measure
Commits
1f163d51
Commit
1f163d51
authored
Jun 28, 2018
by
Theophile GENTILHOMME
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[script][figure] Add decimal control in the printing of metrics
parent
c22526f0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
bob/measure/script/common_options.py
bob/measure/script/common_options.py
+14
-0
bob/measure/script/figure.py
bob/measure/script/figure.py
+11
-9
No files found.
bob/measure/script/common_options.py
View file @
1f163d51
...
...
@@ -375,6 +375,19 @@ def criterion_option(lcriteria=['eer', 'min-hter', 'far'], **kwargs):
return
custom_criterion_option
def
decimal_option
(
dflt
=
2
,
**
kwargs
):
'''Get option to get decimal value'''
def
custom_decimal_option
(
func
):
def
callback
(
ctx
,
param
,
value
):
ctx
.
meta
[
'decimal'
]
=
value
return
value
return
click
.
option
(
'-d'
,
'--decimal'
,
type
=
click
.
INT
,
default
=
dflt
,
help
=
'Number of decimals to be printed.'
,
callback
=
callback
,
show_default
=
True
,
**
kwargs
)(
func
)
return
custom_decimal_option
def
far_option
(
**
kwargs
):
'''Get option to get far value'''
def
custom_far_option
(
func
):
...
...
@@ -589,6 +602,7 @@ def metrics_command(docstring, criteria=('eer', 'min-hter', 'far')):
@
verbosity_option
()
@
click
.
pass_context
@
functools
.
wraps
(
func
)
@
decimal_option
()
def
wrapper
(
*
args
,
**
kwds
):
return
func
(
*
args
,
**
kwds
)
return
wrapper
...
...
bob/measure/script/figure.py
View file @
1f163d51
...
...
@@ -219,15 +219,17 @@ class Metrics(MeasureBase):
recall
,
f1_score
)
def
_strings
(
self
,
metrics
):
fta_str
=
"%.1f%%"
%
(
100
*
metrics
[
0
])
fmr_str
=
"%.1f%% (%d/%d)"
%
(
100
*
metrics
[
1
],
metrics
[
6
],
metrics
[
7
])
fnmr_str
=
"%.1f%% (%d/%d)"
%
(
100
*
metrics
[
2
],
metrics
[
8
],
metrics
[
9
])
far_str
=
"%.1f%%"
%
(
100
*
metrics
[
4
])
frr_str
=
"%.1f%%"
%
(
100
*
metrics
[
5
])
hter_str
=
"%.1f%%"
%
(
100
*
metrics
[
3
])
prec_str
=
"%.1f"
%
(
metrics
[
10
])
recall_str
=
"%.1f"
%
(
metrics
[
11
])
f1_str
=
"%.1f"
%
(
metrics
[
12
])
fta_str
=
"%s%%"
%
format
(
100
*
metrics
[
0
],
'.%df'
%
self
.
_decimal
)
fmr_str
=
"%s%% (%d/%d)"
%
(
format
(
100
*
metrics
[
1
],
'.%df'
%
self
.
_decimal
),
metrics
[
6
],
metrics
[
7
])
fnmr_str
=
"%s%% (%d/%d)"
%
(
format
(
100
*
metrics
[
2
],
'.%df'
%
self
.
_decimal
),
metrics
[
8
],
metrics
[
9
])
far_str
=
"%s%%"
%
format
(
100
*
metrics
[
4
],
'.%df'
%
self
.
_decimal
)
frr_str
=
"%s%%"
%
format
(
100
*
metrics
[
5
],
'.%df'
%
self
.
_decimal
)
hter_str
=
"%s%%"
%
format
(
100
*
metrics
[
3
],
'.%df'
%
self
.
_decimal
)
prec_str
=
"%s"
%
format
(
metrics
[
10
],
'.%df'
%
self
.
_decimal
)
recall_str
=
"%s"
%
format
(
metrics
[
11
],
'.%df'
%
self
.
_decimal
)
f1_str
=
"%s"
%
format
(
metrics
[
12
],
'.%df'
%
self
.
_decimal
)
return
(
fta_str
,
fmr_str
,
fnmr_str
,
far_str
,
frr_str
,
hter_str
,
prec_str
,
recall_str
,
f1_str
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment