mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Made this code slightly more robust.
--HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403046
This commit is contained in:
parent
56901135a0
commit
dcd322dd35
@ -5,6 +5,7 @@
|
||||
|
||||
#include "roc_trainer_abstract.h"
|
||||
#include "../algs.h"
|
||||
#include <limits>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -101,6 +102,16 @@ namespace dlib
|
||||
|
||||
df.b = scores[idx];
|
||||
|
||||
// In this case add a very small extra amount to the bias so that all the samples
|
||||
// with the class_selection label are classified correctly.
|
||||
if (desired_accuracy == 1)
|
||||
{
|
||||
if (class_selection == +1)
|
||||
df.b -= std::numeric_limits<scalar_type>::epsilon()*df.b;
|
||||
else
|
||||
df.b += std::numeric_limits<scalar_type>::epsilon()*df.b;
|
||||
}
|
||||
|
||||
return df;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user