Commit 8dad77dd authored by Davis King's avatar Davis King

Made the svm_c_ekm_trainer print out the projection error for the margin violators

when in verbose mode.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403672
parent fd932000
......@@ -376,7 +376,7 @@ namespace dlib
if (verbose)
{
std::cout << "\nMean EKM projection error: " << rs.mean() << std::endl;
std::cout << "Standard deviaion of EKM projection error: " << rs.stddev() << std::endl;
std::cout << "Standard deviation of EKM projection error: " << rs.stddev() << std::endl;
}
// now do the training
......@@ -546,7 +546,7 @@ namespace dlib
// Reproject all the data samples using the final basis. We could just use what we
// already have but the recursive thing done above to compute the proj_samples
// might have accumulated a little numerical error. So lets just be safe.
running_stats<scalar_type> rs;
running_stats<scalar_type> rs, rs_margin;
for (long i = 0; i < x.size(); ++i)
{
if (verbose)
......@@ -554,6 +554,9 @@ namespace dlib
scalar_type err;
proj_samples[i] = ekm.project(x(i),err);
rs.add(err);
// if this point is within the margin
if (df(proj_samples[i])*y(i) < 1)
rs_margin.add(err);
}
else
{
......@@ -569,7 +572,10 @@ namespace dlib
if (verbose)
{
std::cout << "\nMean EKM projection error: " << rs.mean() << std::endl;
std::cout << "Standard deviaion of EKM projection error: " << rs.stddev() << std::endl;
std::cout << "Standard deviation of EKM projection error: " << rs.stddev() << std::endl;
std::cout << "Mean EKM projection error for margin violators: " << rs_margin.mean() << std::endl;
std::cout << "Standard deviation of EKM projection error for margin violators: " << ((rs_margin.current_n()>1)?rs_margin.stddev():0) << std::endl;
std::cout << "Final svm objective: " << svm_objective << std::endl;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment