Commit 28da58f0 authored by Davis King's avatar Davis King

Added a max iterations option to the svm_multiclass_linear_trainer.

parent 1372472d
......@@ -188,6 +188,7 @@ namespace dlib
num_threads(4),
C(1),
eps(0.001),
max_iterations(10000),
verbose(false),
learn_nonnegative_weights(false)
{
......@@ -224,6 +225,16 @@ namespace dlib
const scalar_type get_epsilon (
) const { return eps; }
unsigned long get_max_iterations (
) const { return max_iterations; }
void set_max_iterations (
unsigned long max_iter
)
{
max_iterations = max_iter;
}
void be_verbose (
)
{
......@@ -358,6 +369,7 @@ namespace dlib
problem.set_max_cache_size(0);
problem.set_c(C);
problem.set_epsilon(eps);
problem.set_max_iterations(max_iterations);
unsigned long num_nonnegative = 0;
if (learn_nonnegative_weights)
......@@ -403,6 +415,7 @@ namespace dlib
unsigned long num_threads;
scalar_type C;
scalar_type eps;
unsigned long max_iterations;
bool verbose;
oca solver;
bool learn_nonnegative_weights;
......
......@@ -34,6 +34,7 @@ namespace dlib
- get_num_threads() == 4
- learns_nonnegative_weights() == false
- get_epsilon() == 0.001
- get_max_iterations() == 10000
- get_c() == 1
- this object will not be verbose unless be_verbose() is called
- #get_oca() == oca() (i.e. an instance of oca with default parameters)
......@@ -79,6 +80,22 @@ namespace dlib
to execute.
!*/
void set_max_iterations (
unsigned long max_iter
);
/*!
ensures
- #get_max_iterations() == max_iter
!*/
unsigned long get_max_iterations (
);
/*!
ensures
- returns the maximum number of iterations the SVM optimizer is allowed to
run before it is required to stop and return a result.
!*/
void be_verbose (
);
/*!
......
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