Commit ec79a937 authored by Davis King's avatar Davis King

Made the svm_c_linear_trainer use the risk gap to decide when to stop. So now

it interprets its epsilon parameter the same way the other OCA based SVM tools
in dlib do.  It also has a more intuitive interpretation than the previous
stopping condition.
parent bad30bcf
......@@ -74,8 +74,8 @@ namespace dlib
virtual bool optimization_status (
scalar_type current_objective_value,
scalar_type current_error_gap,
scalar_type ,
scalar_type ,
scalar_type current_risk_value,
scalar_type current_risk_gap,
unsigned long num_cutting_planes,
unsigned long num_iterations
) const
......@@ -83,20 +83,19 @@ namespace dlib
if (be_verbose)
{
using namespace std;
cout << "svm objective: " << current_objective_value << endl;
cout << "gap: " << current_error_gap << endl;
cout << "num planes: " << num_cutting_planes << endl;
cout << "iter: " << num_iterations << endl;
cout << "objective: " << current_objective_value << endl;
cout << "objective gap: " << current_error_gap << endl;
cout << "risk: " << current_risk_value << endl;
cout << "risk gap: " << current_risk_gap << endl;
cout << "num planes: " << num_cutting_planes << endl;
cout << "iter: " << num_iterations << endl;
cout << endl;
}
if (num_iterations >= max_iterations)
return true;
if (current_objective_value == 0)
return true;
if (current_error_gap/current_objective_value < eps)
if (current_risk_gap < eps)
return true;
return false;
......
......@@ -88,8 +88,10 @@ namespace dlib
/*!
ensures
- returns the error epsilon that determines when training should stop.
Smaller values may result in a more accurate solution but take longer
to execute.
Smaller values may result in a more accurate solution but take longer to
train. You can think of this epsilon value as saying "solve the
optimization problem until the probability of misclassification is within
epsilon of its optimal value".
!*/
void set_max_iterations (
......
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