Commit 384090c6 authored by Davis King's avatar Davis King

The structural SVM optimizers had checks that the risk never became negative.

This only happens if the user implements the separation oracle wrong.  In this
case I had the code setup to force the risk to zero but this just ends up
obscuring the fact that the user's separation oracle is incorrect.  So I'm
removing this check.  This should make debugging separation oracles a little
easier.
parent 7638057b
......@@ -568,8 +568,7 @@ namespace dlib
subgradient /= num;
total_loss /= num;
// Include a sanity check that the risk is always non-negative.
risk = std::max<scalar_type>(total_loss + dot(subgradient,w), 0);
risk = total_loss + dot(subgradient,w);
}
std::vector<std::pair<std::string,unsigned short> > nodes;
......
......@@ -348,8 +348,7 @@ namespace dlib
subgradient /= num;
total_loss /= num;
// Include a sanity check that the risk is always non-negative.
risk = std::max<scalar_type>(total_loss + dot(subgradient,w), 0);
risk = total_loss + dot(subgradient,w);
}
virtual void call_separation_oracle_on_all_samples (
......
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