Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
d3a3288e
Commit
d3a3288e
authored
May 05, 2015
by
Davis King
Browse files
Added a max iterations option to the sequence labeling and segmentation
learning tools.
parent
28da58f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
0 deletions
+59
-0
dlib/svm/structural_sequence_labeling_trainer.h
dlib/svm/structural_sequence_labeling_trainer.h
+13
-0
dlib/svm/structural_sequence_labeling_trainer_abstract.h
dlib/svm/structural_sequence_labeling_trainer_abstract.h
+18
-0
dlib/svm/structural_sequence_segmentation_trainer.h
dlib/svm/structural_sequence_segmentation_trainer.h
+10
-0
dlib/svm/structural_sequence_segmentation_trainer_abstract.h
dlib/svm/structural_sequence_segmentation_trainer_abstract.h
+18
-0
No files found.
dlib/svm/structural_sequence_labeling_trainer.h
View file @
d3a3288e
...
@@ -76,6 +76,16 @@ namespace dlib
...
@@ -76,6 +76,16 @@ namespace dlib
double
get_epsilon
(
double
get_epsilon
(
)
const
{
return
eps
;
}
)
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
(
void
set_max_cache_size
(
unsigned
long
max_size
unsigned
long
max_size
)
)
...
@@ -215,6 +225,7 @@ namespace dlib
...
@@ -215,6 +225,7 @@ namespace dlib
prob
.
be_verbose
();
prob
.
be_verbose
();
prob
.
set_epsilon
(
eps
);
prob
.
set_epsilon
(
eps
);
prob
.
set_max_iterations
(
max_iterations
);
prob
.
set_c
(
C
);
prob
.
set_c
(
C
);
prob
.
set_max_cache_size
(
max_cache_size
);
prob
.
set_max_cache_size
(
max_cache_size
);
for
(
unsigned
long
i
=
0
;
i
<
loss_values
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
loss_values
.
size
();
++
i
)
...
@@ -230,6 +241,7 @@ namespace dlib
...
@@ -230,6 +241,7 @@ namespace dlib
double
C
;
double
C
;
oca
solver
;
oca
solver
;
double
eps
;
double
eps
;
unsigned
long
max_iterations
;
bool
verbose
;
bool
verbose
;
unsigned
long
num_threads
;
unsigned
long
num_threads
;
unsigned
long
max_cache_size
;
unsigned
long
max_cache_size
;
...
@@ -240,6 +252,7 @@ namespace dlib
...
@@ -240,6 +252,7 @@ namespace dlib
C
=
100
;
C
=
100
;
verbose
=
false
;
verbose
=
false
;
eps
=
0.1
;
eps
=
0.1
;
max_iterations
=
10000
;
num_threads
=
2
;
num_threads
=
2
;
max_cache_size
=
5
;
max_cache_size
=
5
;
loss_values
.
assign
(
num_labels
(),
1
);
loss_values
.
assign
(
num_labels
(),
1
);
...
...
dlib/svm/structural_sequence_labeling_trainer_abstract.h
View file @
d3a3288e
...
@@ -47,6 +47,7 @@ namespace dlib
...
@@ -47,6 +47,7 @@ namespace dlib
- #get_c() == 100
- #get_c() == 100
- this object isn't verbose
- this object isn't verbose
- #get_epsilon() == 0.1
- #get_epsilon() == 0.1
- #get_max_iterations() == 10000
- #get_num_threads() == 2
- #get_num_threads() == 2
- #get_max_cache_size() == 5
- #get_max_cache_size() == 5
- #get_feature_extractor() == a default initialized feature_extractor
- #get_feature_extractor() == a default initialized feature_extractor
...
@@ -60,6 +61,7 @@ namespace dlib
...
@@ -60,6 +61,7 @@ namespace dlib
- #get_c() == 100
- #get_c() == 100
- this object isn't verbose
- this object isn't verbose
- #get_epsilon() == 0.1
- #get_epsilon() == 0.1
- #get_max_iterations() == 10000
- #get_num_threads() == 2
- #get_num_threads() == 2
- #get_max_cache_size() == 5
- #get_max_cache_size() == 5
- #get_feature_extractor() == fe
- #get_feature_extractor() == fe
...
@@ -119,6 +121,22 @@ namespace dlib
...
@@ -119,6 +121,22 @@ namespace dlib
training sample is within epsilon of its optimal value".
training sample is within epsilon of its optimal value".
!*/
!*/
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
(
void
set_max_cache_size
(
unsigned
long
max_size
unsigned
long
max_size
);
);
...
...
dlib/svm/structural_sequence_segmentation_trainer.h
View file @
d3a3288e
...
@@ -72,6 +72,16 @@ namespace dlib
...
@@ -72,6 +72,16 @@ namespace dlib
double
get_epsilon
(
double
get_epsilon
(
)
const
{
return
trainer
.
get_epsilon
();
}
)
const
{
return
trainer
.
get_epsilon
();
}
unsigned
long
get_max_iterations
(
)
const
{
return
trainer
.
get_max_iterations
();
}
void
set_max_iterations
(
unsigned
long
max_iter
)
{
trainer
.
set_max_iterations
(
max_iter
);
}
void
set_max_cache_size
(
void
set_max_cache_size
(
unsigned
long
max_size
unsigned
long
max_size
)
)
...
...
dlib/svm/structural_sequence_segmentation_trainer_abstract.h
View file @
d3a3288e
...
@@ -44,6 +44,7 @@ namespace dlib
...
@@ -44,6 +44,7 @@ namespace dlib
- #get_c() == 100
- #get_c() == 100
- this object isn't verbose
- this object isn't verbose
- #get_epsilon() == 0.1
- #get_epsilon() == 0.1
- #get_max_iterations() == 10000
- #get_num_threads() == 2
- #get_num_threads() == 2
- #get_max_cache_size() == 40
- #get_max_cache_size() == 40
- #get_feature_extractor() == a default initialized feature_extractor
- #get_feature_extractor() == a default initialized feature_extractor
...
@@ -59,6 +60,7 @@ namespace dlib
...
@@ -59,6 +60,7 @@ namespace dlib
- #get_c() == 100
- #get_c() == 100
- this object isn't verbose
- this object isn't verbose
- #get_epsilon() == 0.1
- #get_epsilon() == 0.1
- #get_max_iterations() == 10000
- #get_num_threads() == 2
- #get_num_threads() == 2
- #get_max_cache_size() == 40
- #get_max_cache_size() == 40
- #get_feature_extractor() == fe
- #get_feature_extractor() == fe
...
@@ -111,6 +113,22 @@ namespace dlib
...
@@ -111,6 +113,22 @@ namespace dlib
per training sample is within epsilon of its optimal value".
per training sample is within epsilon of its optimal value".
!*/
!*/
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
(
void
set_max_cache_size
(
unsigned
long
max_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