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
0
Merge Requests
0
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
f67d3a34
Commit
f67d3a34
authored
Nov 16, 2017
by
Amir MOHAMMADI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute roc using roc_for_far internally
parent
4281a0c2
Pipeline
#14105
passed with stages
in 16 minutes and 40 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
15 deletions
+12
-15
bob/measure/cpp/error.cpp
bob/measure/cpp/error.cpp
+10
-13
bob/measure/data/nonsep-det.hdf5
bob/measure/data/nonsep-det.hdf5
+0
-0
bob/measure/data/nonsep-roc.hdf5
bob/measure/data/nonsep-roc.hdf5
+0
-0
bob/measure/test_error.py
bob/measure/test_error.py
+2
-2
No files found.
bob/measure/cpp/error.cpp
View file @
f67d3a34
...
...
@@ -214,18 +214,15 @@ double bob::measure::minWeightedErrorRateThreshold(
blitz
::
Array
<
double
,
2
>
bob
::
measure
::
roc
(
const
blitz
::
Array
<
double
,
1
>
&
negatives
,
const
blitz
::
Array
<
double
,
1
>
&
positives
,
size_t
points
)
{
double
min
=
std
::
min
(
blitz
::
min
(
negatives
),
blitz
::
min
(
positives
));
double
max
=
std
::
max
(
blitz
::
max
(
negatives
),
blitz
::
max
(
positives
));
double
step
=
(
max
-
min
)
/
((
double
)
points
-
1.0
);
blitz
::
Array
<
double
,
2
>
retval
(
2
,
points
);
for
(
int
i
=
0
;
i
<
(
int
)
points
;
++
i
)
{
std
::
pair
<
double
,
double
>
ratios
=
bob
::
measure
::
farfrr
(
negatives
,
positives
,
min
+
i
*
step
);
// preserve X x Y ordering (FAR x FRR)
retval
(
0
,
i
)
=
ratios
.
first
;
retval
(
1
,
i
)
=
ratios
.
second
;
// Uses roc_for_far internally
// Create an far_list
blitz
::
Array
<
double
,
1
>
far_list
((
int
)
points
);
int
min_far
=
-
8
;
// minimum FAR in terms of 10^(min_far)
double
counts_per_step
=
points
/
(
-
min_far
)
;
for
(
int
i
=
1
-
(
int
)
points
;
i
<=
0
;
++
i
)
{
far_list
(
i
+
(
int
)
points
-
1
)
=
std
::
pow
(
10.
,
(
double
)
i
/
counts_per_step
);
}
return
retval
;
return
bob
::
measure
::
roc_for_far
(
negatives
,
positives
,
far_list
,
false
)
;
}
blitz
::
Array
<
double
,
2
>
...
...
@@ -445,9 +442,9 @@ bob::measure::roc_for_far(const blitz::Array<double, 1> &negatives,
if
(
far_index
>=
0
)
{
// walk to the end of both lists; at least one of both lists should already
// have reached its limit.
while
(
pos_it
++
!=
pos
.
end
())
while
(
pos_it
!=
pos
.
end
()
&&
pos_it
++
!=
pos
.
end
())
++
pos_index
;
while
(
neg_it
++
!=
neg
.
end
())
while
(
neg_it
!=
neg
.
end
()
&&
neg_it
++
!=
neg
.
end
())
++
neg_index
;
// fill in the remaining elements of the CAR list
do
{
...
...
bob/measure/data/nonsep-det.hdf5
View file @
f67d3a34
No preview for this file type
bob/measure/data/nonsep-roc.hdf5
View file @
f67d3a34
No preview for this file type
bob/measure/test_error.py
View file @
f67d3a34
...
...
@@ -251,7 +251,7 @@ def test_plots():
# This example will test the ROC plot calculation functionality.
xy
=
roc
(
negatives
,
positives
,
100
)
# uncomment the next line to save a reference value
# save(
'nonsep-roc.hdf5'
, xy)
# save(
F('nonsep-roc.hdf5')
, xy)
xyref
=
bob
.
io
.
base
.
load
(
F
(
'nonsep-roc.hdf5'
))
assert
numpy
.
array_equal
(
xy
,
xyref
)
...
...
@@ -273,7 +273,7 @@ def test_plots():
# This example will test the DET plot calculation functionality.
det_xyzw
=
det
(
negatives
,
positives
,
100
)
# uncomment the next line to save a reference value
# save(
'nonsep-det.hdf5'
, det_xyzw)
# save(
F('nonsep-det.hdf5')
, det_xyzw)
det_xyzw_ref
=
bob
.
io
.
base
.
load
(
F
(
'nonsep-det.hdf5'
))
assert
numpy
.
allclose
(
det_xyzw
,
det_xyzw_ref
,
atol
=
1e-15
)
...
...
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