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
df9e53bb
Commit
df9e53bb
authored
Aug 19, 2019
by
Amir MOHAMMADI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an alpha option to ROC,DET,EPC figures
parent
eeed95c2
Pipeline
#32563
passed with stage
in 36 minutes and 37 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
9 deletions
+34
-9
bob/measure/script/common_options.py
bob/measure/script/common_options.py
+19
-2
bob/measure/script/figure.py
bob/measure/script/figure.py
+15
-7
No files found.
bob/measure/script/common_options.py
View file @
df9e53bb
...
...
@@ -59,6 +59,20 @@ def scores_argument(min_arg=1, force_eval=False, **kwargs):
return
custom_scores_argument
def
alpha_option
(
dflt
=
1
,
**
kwargs
):
'''An alpha option for plots'''
def
custom_eval_option
(
func
):
def
callback
(
ctx
,
param
,
value
):
ctx
.
meta
[
'alpha'
]
=
value
return
value
return
click
.
option
(
'-a'
,
'--alpha'
,
default
=
dflt
,
type
=
click
.
FLOAT
,
show_default
=
True
,
help
=
'Adjusts transparency of plots.'
,
callback
=
callback
,
**
kwargs
)(
func
)
return
custom_eval_option
def
no_legend_option
(
dflt
=
True
,
**
kwargs
):
'''Get option flag to say if legend should be displayed or not'''
return
bool_option
(
...
...
@@ -284,7 +298,7 @@ def n_bins_option(**kwargs):
return
custom_n_bins_option
def
table_option
(
**
kwargs
):
def
table_option
(
dflt
=
"rst"
,
**
kwargs
):
'''Get table option for tabulate package
More informnations: https://pypi.org/project/tabulate/
'''
...
...
@@ -294,7 +308,7 @@ def table_option(**kwargs):
return
value
return
click
.
option
(
'--tablefmt'
,
type
=
click
.
Choice
(
tabulate
.
tabulate_formats
),
default
=
'rst'
,
show_default
=
True
,
help
=
'Format of printed tables.'
,
default
=
dflt
,
show_default
=
True
,
help
=
'Format of printed tables.'
,
callback
=
callback
,
**
kwargs
)(
func
)
return
custom_table_option
...
...
@@ -664,6 +678,7 @@ def roc_command(docstring, far_name="FAR"):
@
figsize_option
()
@
style_option
()
@
linestyles_option
()
@
alpha_option
()
@
verbosity_option
()
@
click
.
pass_context
@
functools
.
wraps
(
func
)
...
...
@@ -718,6 +733,7 @@ def det_command(docstring, far_name="FAR"):
@
figsize_option
()
@
style_option
()
@
linestyles_option
()
@
alpha_option
()
@
verbosity_option
()
@
click
.
pass_context
@
functools
.
wraps
(
func
)
...
...
@@ -765,6 +781,7 @@ def epc_command(docstring):
@
figsize_option
()
@
style_option
()
@
linestyles_option
()
@
alpha_option
()
@
verbosity_option
()
@
click
.
pass_context
@
functools
.
wraps
(
func
)
...
...
bob/measure/script/figure.py
View file @
df9e53bb
...
...
@@ -430,6 +430,7 @@ class PlotBase(MeasureBase):
self
.
_points
=
ctx
.
meta
.
get
(
'points'
,
2000
)
self
.
_split
=
ctx
.
meta
.
get
(
'split'
)
self
.
_axlim
=
ctx
.
meta
.
get
(
'axlim'
)
self
.
_alpha
=
ctx
.
meta
.
get
(
'alpha'
)
self
.
_disp_legend
=
ctx
.
meta
.
get
(
'disp_legend'
,
True
)
self
.
_legend_loc
=
ctx
.
meta
.
get
(
'legend_loc'
)
self
.
_min_dig
=
None
...
...
@@ -571,7 +572,8 @@ class Roc(PlotBase):
CAR
=
self
.
_semilogx
,
min_far
=
self
.
_min_dig
,
color
=
self
.
_colors
[
idx
],
linestyle
=
self
.
_linestyles
[
idx
],
label
=
self
.
_label
(
'dev'
,
idx
)
label
=
self
.
_label
(
'dev'
,
idx
),
alpha
=
self
.
_alpha
,
)
if
self
.
_split
:
mpl
.
figure
(
2
)
...
...
@@ -584,7 +586,8 @@ class Roc(PlotBase):
CAR
=
self
.
_semilogx
,
min_far
=
self
.
_min_dig
,
color
=
self
.
_colors
[
idx
],
label
=
self
.
_label
(
'eval.'
,
idx
)
label
=
self
.
_label
(
'eval.'
,
idx
),
alpha
=
self
.
_alpha
,
)
if
self
.
_far_at
is
not
None
:
from
..
import
fprfnr
...
...
@@ -604,7 +607,8 @@ class Roc(PlotBase):
CAR
=
self
.
_semilogx
,
min_far
=
self
.
_min_dig
,
color
=
self
.
_colors
[
idx
],
linestyle
=
self
.
_linestyles
[
idx
],
label
=
self
.
_label
(
'dev'
,
idx
)
label
=
self
.
_label
(
'dev'
,
idx
),
alpha
=
self
.
_alpha
,
)
...
...
@@ -648,7 +652,8 @@ class Det(PlotBase):
dev_neg
,
dev_pos
,
self
.
_points
,
min_far
=
self
.
_min_dig
,
color
=
self
.
_colors
[
idx
],
linestyle
=
self
.
_linestyles
[
idx
],
label
=
self
.
_label
(
'dev.'
,
idx
)
label
=
self
.
_label
(
'dev.'
,
idx
),
alpha
=
self
.
_alpha
,
)
if
self
.
_split
:
mpl
.
figure
(
2
)
...
...
@@ -658,7 +663,8 @@ class Det(PlotBase):
eval_neg
,
eval_pos
,
self
.
_points
,
min_far
=
self
.
_min_dig
,
color
=
self
.
_colors
[
idx
],
linestyle
=
linestyle
,
label
=
self
.
_label
(
'eval.'
,
idx
)
label
=
self
.
_label
(
'eval.'
,
idx
),
alpha
=
self
.
_alpha
,
)
if
self
.
_far_at
is
not
None
:
from
..
import
farfrr
...
...
@@ -675,7 +681,8 @@ class Det(PlotBase):
dev_neg
,
dev_pos
,
self
.
_points
,
min_far
=
self
.
_min_dig
,
color
=
self
.
_colors
[
idx
],
linestyle
=
self
.
_linestyles
[
idx
],
label
=
self
.
_label
(
'dev.'
,
idx
)
label
=
self
.
_label
(
'dev.'
,
idx
),
alpha
=
self
.
_alpha
,
)
def
_set_axis
(
self
):
...
...
@@ -713,7 +720,8 @@ class Epc(PlotBase):
color
=
self
.
_colors
[
idx
],
linestyle
=
self
.
_linestyles
[
idx
],
label
=
self
.
_label
(
'curve'
,
idx
)
),
alpha
=
self
.
_alpha
,
)
...
...
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