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
ef682da1
Commit
ef682da1
authored
Feb 22, 2019
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_minimizing_threshold' into 'master'
Fix minimizing threshold Closes
#59
See merge request
!92
parents
022f9712
ad5bb33c
Pipeline
#28002
failed with stages
in 4 minutes and 4 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
bob/measure/cpp/error.h
bob/measure/cpp/error.h
+17
-0
bob/measure/test_error.py
bob/measure/test_error.py
+15
-0
No files found.
bob/measure/cpp/error.h
View file @
ef682da1
...
...
@@ -211,6 +211,7 @@ double minimizingThreshold(const blitz::Array<double, 1> &negatives,
else
current_threshold
+=
*
pos_it
;
current_threshold
/=
2
;
}
}
// while
...
...
@@ -222,6 +223,22 @@ double minimizingThreshold(const blitz::Array<double, 1> &negatives,
min_threshold
=
current_threshold
;
}
// now we just double check choosing the threshold higher than all scores will not improve the min_predicate
if
(
neg_it
!=
negatives
.
end
()
||
pos_it
!=
positives
.
end
())
{
double
last_threshold
=
current_threshold
;
if
(
neg_it
!=
negatives
.
end
())
last_threshold
=
std
::
nextafter
(
negatives
(
negatives
.
extent
(
0
)
-
1
),
negatives
(
negatives
.
extent
(
0
)
-
1
)
+
1
);
else
{
if
(
pos_it
!=
positives
.
end
())
last_threshold
=
std
::
nextafter
(
positives
(
positives
.
extent
(
0
)
-
1
),
positives
(
positives
.
extent
(
0
)
-
1
)
+
1
);
}
current_predicate
=
predicate
(
0.
,
1.
);
if
(
current_predicate
<
min_predicate
)
{
min_predicate
=
current_predicate
;
min_threshold
=
last_threshold
;
}
}
// return the best threshold found
return
min_threshold
;
}
...
...
bob/measure/test_error.py
View file @
ef682da1
...
...
@@ -489,3 +489,18 @@ def test_open_set_rates():
assert
abs
(
bob
.
measure
.
recognition_rate
(
cmc_scores
)
-
6.
/
9.
)
<
1e-8
assert
abs
(
bob
.
measure
.
recognition_rate
(
cmc_scores
,
threshold
=
0.5
)
-
6.
/
8.
)
<
1e-8
def
test_mindcf
():
""" Test outlier scores in negative set
"""
from
bob.measure
import
min_weighted_error_rate_threshold
,
farfrr
cost
=
0.99
negatives
=
[
-
3
,
-
2
,
-
1
,
-
0.5
,
4
]
positives
=
[
0.5
,
3
]
th
=
min_weighted_error_rate_threshold
(
negatives
,
positives
,
cost
,
True
)
far
,
frr
=
farfrr
(
negatives
,
positives
,
th
)
mindcf
=
(
cost
*
far
+
(
1
-
cost
)
*
frr
)
*
100
assert
mindcf
<
1.0
+
1e-8
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