Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
1372472d
Commit
1372472d
authored
May 05, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an optional hard limit on the number of iterations in the
structural SVM solver.
parent
65d838e6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
0 deletions
+63
-0
structural_svm_distributed.h
dlib/svm/structural_svm_distributed.h
+13
-0
structural_svm_distributed_abstract.h
dlib/svm/structural_svm_distributed_abstract.h
+17
-0
structural_svm_problem.h
dlib/svm/structural_svm_problem.h
+16
-0
structural_svm_problem_abstract.h
dlib/svm/structural_svm_problem_abstract.h
+17
-0
No files found.
dlib/svm/structural_svm_distributed.h
View file @
1372472d
...
...
@@ -345,6 +345,7 @@ namespace dlib
svm_struct_controller_node
(
)
:
eps
(
0
.
001
),
max_iterations
(
10000
),
cache_based_eps
(
std
::
numeric_limits
<
double
>::
infinity
()),
verbose
(
false
),
C
(
1
)
...
...
@@ -389,6 +390,16 @@ namespace dlib
double
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
(
)
{
...
...
@@ -515,6 +526,7 @@ namespace dlib
problem_type
<
matrix_type
>
problem
(
nodes
);
problem
.
set_cache_based_epsilon
(
cache_based_eps
);
problem
.
set_epsilon
(
eps
);
problem
.
set_max_iterations
(
max_iterations
);
if
(
verbose
)
problem
.
be_verbose
();
problem
.
set_c
(
C
);
...
...
@@ -674,6 +686,7 @@ namespace dlib
std
::
vector
<
network_address
>
nodes
;
double
eps
;
unsigned
long
max_iterations
;
double
cache_based_eps
;
bool
verbose
;
double
C
;
...
...
dlib/svm/structural_svm_distributed_abstract.h
View file @
1372472d
...
...
@@ -64,6 +64,7 @@ namespace dlib
INITIAL VALUE
- get_num_processing_nodes() == 0
- get_epsilon() == 0.001
- get_max_iterations() == 10000
- get_c() == 1
- This object will not be verbose
...
...
@@ -182,6 +183,22 @@ namespace dlib
- #get_cache_based_epsilon() == eps
!*/
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
add_nuclear_norm_regularizer
(
long
first_dimension
,
long
rows
,
...
...
dlib/svm/structural_svm_problem.h
View file @
1372472d
...
...
@@ -239,6 +239,7 @@ namespace dlib
CONVENTION
- C == get_c()
- eps == get_epsilon()
- max_iterations == get_max_iterations()
- if (skip_cache) then
- we won't use the oracle cache when we need to evaluate the separation
oracle. Instead, we will directly call the user supplied separation_oracle().
...
...
@@ -259,6 +260,7 @@ namespace dlib
)
:
saved_current_risk_gap
(
0
),
eps
(
0
.
001
),
max_iterations
(
10000
),
verbose
(
false
),
skip_cache
(
true
),
count_below_eps
(
0
),
...
...
@@ -308,6 +310,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
set_max_cache_size
(
unsigned
long
max_size
)
...
...
@@ -445,6 +457,9 @@ namespace dlib
cout
<<
endl
;
}
if
(
num_iterations
>=
max_iterations
)
return
true
;
saved_current_risk_gap
=
current_risk_gap
;
if
(
converged
)
...
...
@@ -611,6 +626,7 @@ namespace dlib
mutable
scalar_type
saved_current_risk_gap
;
mutable
matrix_type
psi_true
;
scalar_type
eps
;
unsigned
long
max_iterations
;
mutable
bool
verbose
;
...
...
dlib/svm/structural_svm_problem_abstract.h
View file @
1372472d
...
...
@@ -29,6 +29,7 @@ namespace dlib
INITIAL VALUE
- get_epsilon() == 0.001
- get_max_iterations() == 10000
- get_max_cache_size() == 5
- get_c() == 1
- get_cache_based_epsilon() == std::numeric_limits<scalar_type>::infinity()
...
...
@@ -161,6 +162,22 @@ namespace dlib
- #get_cache_based_epsilon() == eps
!*/
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
set_max_cache_size
(
unsigned
long
max_size
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment