Made this code slightly more robust.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403046
This commit is contained in:
Davis King 2009-05-20 00:34:32 +00:00
parent 56901135a0
commit dcd322dd35

View File

@ -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;
}