Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.measure
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.measure
Commits
602579c4
Commit
602579c4
authored
11 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Inline plotting code
parent
97f8d8e3
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/guide.rst
+49
-11
49 additions, 11 deletions
doc/guide.rst
doc/plot/perf_det.py
+0
-20
0 additions, 20 deletions
doc/plot/perf_det.py
doc/plot/perf_epc.py
+0
-18
0 additions, 18 deletions
doc/plot/perf_epc.py
doc/plot/perf_roc.py
+0
-18
0 additions, 18 deletions
doc/plot/perf_roc.py
with
49 additions
and
67 deletions
doc/guide.rst
+
49
−
11
View file @
602579c4
...
@@ -185,8 +185,20 @@ town. To plot an ROC curve, in possession of your **negatives** and
...
@@ -185,8 +185,20 @@ town. To plot an ROC curve, in possession of your **negatives** and
You should see an image like the following one:
You should see an image like the following one:
.. plot:: plot/perf_roc.py
.. plot::
:include-source: False
import numpy
import xbob.measure
from matplotlib import pyplot
positives = numpy.random.normal(1,1,100)
negatives = numpy.random.normal(-1,1,100)
npoints = 100
xbob.measure.plot.roc(negatives, positives, npoints, color=(0,0,0), linestyle='-', label='test')
pyplot.grid(True)
pyplot.xlabel('FAR (%)')
pyplot.ylabel('FRR (%)')
pyplot.title('ROC')
As can be observed, plotting methods live in the namespace
As can be observed, plotting methods live in the namespace
:py:mod:`xbob.measure.plot`. They work like `Matplotlib`_'s `plot()`_ method
:py:mod:`xbob.measure.plot`. They work like `Matplotlib`_'s `plot()`_ method
...
@@ -221,8 +233,22 @@ A DET curve can be drawn using similar commands such as the ones for the ROC cur
...
@@ -221,8 +233,22 @@ A DET curve can be drawn using similar commands such as the ones for the ROC cur
This will produce an image like the following one:
This will produce an image like the following one:
.. plot:: plot/perf_det.py
.. plot::
:include-source: False
import numpy
import xbob.measure
from matplotlib import pyplot
positives = numpy.random.normal(1,1,100)
negatives = numpy.random.normal(-1,1,100)
npoints = 100
xbob.measure.plot.det(negatives, positives, npoints, color=(0,0,0), linestyle='-', label='test')
xbob.measure.plot.det_axis([0.1, 80, 0.1, 80])
pyplot.grid(True)
pyplot.xlabel('FAR (%)')
pyplot.ylabel('FRR (%)')
pyplot.title('DET')
.. note::
.. note::
...
@@ -257,8 +283,20 @@ the test (or evaluation) set ones. Because of this the API is slightly modified:
...
@@ -257,8 +283,20 @@ the test (or evaluation) set ones. Because of this the API is slightly modified:
This will produce an image like the following one:
This will produce an image like the following one:
.. plot:: plot/perf_epc.py
.. plot::
:include-source: False
import numpy
import xbob.measure
from matplotlib import pyplot
dev_pos = numpy.random.normal(1,1,100)
dev_neg = numpy.random.normal(-1,1,100)
test_pos = numpy.random.normal(0.9,1,100)
test_neg = numpy.random.normal(-1.1,1,100)
npoints = 100
xbob.measure.plot.epc(dev_neg, dev_pos, test_neg, test_pos, npoints, color=(0,0,0), linestyle='-')
pyplot.grid(True)
pyplot.title('EPC')
Fine-tunning
Fine-tunning
============
============
...
@@ -285,7 +323,7 @@ Error Rate) on a set, after setting up |project|, just do:
...
@@ -285,7 +323,7 @@ Error Rate) on a set, after setting up |project|, just do:
.. code-block:: sh
.. code-block:: sh
$ bob_eval_threshold.py --scores=development-scores-4col.txt
$
x
bob_eval_threshold.py --scores=development-scores-4col.txt
Threshold: -0.004787956164
Threshold: -0.004787956164
FAR : 6.731% (35/520)
FAR : 6.731% (35/520)
FRR : 6.667% (26/390)
FRR : 6.667% (26/390)
...
@@ -296,22 +334,22 @@ the given set, calculated using such a threshold. The relative counts of FAs
...
@@ -296,22 +334,22 @@ the given set, calculated using such a threshold. The relative counts of FAs
and FRs are also displayed between parenthesis.
and FRs are also displayed between parenthesis.
To evaluate the performance of a new score file with a given threshold, use the
To evaluate the performance of a new score file with a given threshold, use the
application ``bob_apply_threshold.py``:
application ``
x
bob_apply_threshold.py``:
.. code-block:: sh
.. code-block:: sh
$ bob_apply_threshold.py --scores=test-scores-4col.txt --threshold=-0.0047879
$
x
bob_apply_threshold.py --scores=test-scores-4col.txt --threshold=-0.0047879
FAR : 2.115% (11/520)
FAR : 2.115% (11/520)
FRR : 7.179% (28/390)
FRR : 7.179% (28/390)
HTER: 4.647%
HTER: 4.647%
In this case, only the error figures are presented. You can conduct the
In this case, only the error figures are presented. You can conduct the
evaluation and plotting of development and test set data using our combined
evaluation and plotting of development and test set data using our combined
``bob_compute_perf.py`` script. You pass both sets and it does the rest:
``
x
bob_compute_perf.py`` script. You pass both sets and it does the rest:
.. code-block:: sh
.. code-block:: sh
$ bob_compute_perf.py --devel=development-scores-4col.txt --test=test-scores-4col.txt
$
x
bob_compute_perf.py --devel=development-scores-4col.txt --test=test-scores-4col.txt
[Min. criterium: EER] Threshold on Development set: -4.787956e-03
[Min. criterium: EER] Threshold on Development set: -4.787956e-03
| Development | Test
| Development | Test
-------+-----------------+------------------
-------+-----------------+------------------
...
...
This diff is collapsed.
Click to expand it.
doc/plot/perf_det.py
deleted
100644 → 0
+
0
−
20
View file @
97f8d8e3
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
Tutorial for plotting a DET curve
"""
import
numpy
import
xbob.measure
from
matplotlib
import
pyplot
positives
=
numpy
.
random
.
normal
(
1
,
1
,
100
)
negatives
=
numpy
.
random
.
normal
(
-
1
,
1
,
100
)
npoints
=
100
xbob
.
measure
.
plot
.
det
(
negatives
,
positives
,
npoints
,
color
=
(
0
,
0
,
0
),
linestyle
=
'
-
'
,
label
=
'
test
'
)
xbob
.
measure
.
plot
.
det_axis
([
0.1
,
80
,
0.1
,
80
])
pyplot
.
grid
(
True
)
pyplot
.
xlabel
(
'
FAR (%)
'
)
pyplot
.
ylabel
(
'
FRR (%)
'
)
pyplot
.
title
(
'
DET
'
)
This diff is collapsed.
Click to expand it.
doc/plot/perf_epc.py
deleted
100644 → 0
+
0
−
18
View file @
97f8d8e3
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
Tutorial for plotting an EPC curve
"""
import
numpy
import
xbob.measure
from
matplotlib
import
pyplot
dev_pos
=
numpy
.
random
.
normal
(
1
,
1
,
100
)
dev_neg
=
numpy
.
random
.
normal
(
-
1
,
1
,
100
)
test_pos
=
numpy
.
random
.
normal
(
0.9
,
1
,
100
)
test_neg
=
numpy
.
random
.
normal
(
-
1.1
,
1
,
100
)
npoints
=
100
xbob
.
measure
.
plot
.
epc
(
dev_neg
,
dev_pos
,
test_neg
,
test_pos
,
npoints
,
color
=
(
0
,
0
,
0
),
linestyle
=
'
-
'
)
pyplot
.
grid
(
True
)
pyplot
.
title
(
'
EPC
'
)
This diff is collapsed.
Click to expand it.
doc/plot/perf_roc.py
deleted
100644 → 0
+
0
−
18
View file @
97f8d8e3
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
Tutorial for plotting a ROC curve
"""
import
numpy
import
xbob.measure
from
matplotlib
import
pyplot
positives
=
numpy
.
random
.
normal
(
1
,
1
,
100
)
negatives
=
numpy
.
random
.
normal
(
-
1
,
1
,
100
)
npoints
=
100
xbob
.
measure
.
plot
.
roc
(
negatives
,
positives
,
npoints
,
color
=
(
0
,
0
,
0
),
linestyle
=
'
-
'
,
label
=
'
test
'
)
pyplot
.
grid
(
True
)
pyplot
.
xlabel
(
'
FAR (%)
'
)
pyplot
.
ylabel
(
'
FRR (%)
'
)
pyplot
.
title
(
'
ROC
'
)
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