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
31078ade
"tutorials/models/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "37feb479fd79533f4de10f1fa25a7e9057ff0182"
Commit
31078ade
authored
Mar 16, 2014
by
Csaba Kertesz
Browse files
Add maximal iterations option for relevance vector machine trainer
parent
2ba3c4d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
dlib/svm/rvm.h
dlib/svm/rvm.h
+18
-2
examples/rvm_ex.cpp
examples/rvm_ex.cpp
+5
-0
No files found.
dlib/svm/rvm.h
View file @
31078ade
...
@@ -147,8 +147,21 @@ namespace dlib
...
@@ -147,8 +147,21 @@ namespace dlib
typedef
decision_function
<
kernel_type
>
trained_function_type
;
typedef
decision_function
<
kernel_type
>
trained_function_type
;
rvm_trainer
(
rvm_trainer
(
)
:
eps
(
0.001
)
)
:
eps
(
0.001
),
max_iterations
(
2000
)
{
}
void
set_max_iterations
(
int
max_iterations_
)
{
{
max_iterations
=
max_iterations_
;
}
int
get_max_iterations
(
)
const
{
return
max_iterations
;
}
}
void
set_epsilon
(
void
set_epsilon
(
...
@@ -288,9 +301,11 @@ namespace dlib
...
@@ -288,9 +301,11 @@ namespace dlib
bool
search_all_alphas
=
false
;
bool
search_all_alphas
=
false
;
unsigned
long
ticker
=
0
;
unsigned
long
ticker
=
0
;
const
unsigned
long
rounds_of_narrow_search
=
100
;
const
unsigned
long
rounds_of_narrow_search
=
100
;
int
iterations
=
0
;
while
(
true
)
while
(
iterations
!=
max_iterations
)
{
{
iterations
++
;
if
(
recompute_beta
)
if
(
recompute_beta
)
{
{
// calculate the current t_estimate. (this is the predicted t value for each sample according to the
// calculate the current t_estimate. (this is the predicted t value for each sample according to the
...
@@ -572,6 +587,7 @@ namespace dlib
...
@@ -572,6 +587,7 @@ namespace dlib
// private member variables
// private member variables
kernel_type
kernel
;
kernel_type
kernel
;
scalar_type
eps
;
scalar_type
eps
;
int
max_iterations
;
const
static
scalar_type
tau
;
const
static
scalar_type
tau
;
...
...
examples/rvm_ex.cpp
View file @
31078ade
...
@@ -104,6 +104,11 @@ int main()
...
@@ -104,6 +104,11 @@ int main()
// reliable. But sometimes it works out well. 0.001 is the default.
// reliable. But sometimes it works out well. 0.001 is the default.
trainer
.
set_epsilon
(
0.001
);
trainer
.
set_epsilon
(
0.001
);
// The relevance vector machine with radial basis function tends to learn too long and
// sometimes it is stuck forever. A default iterations limit is 2000, but it can be disabled by
// setting equal or less than zero.
trainer
.
set_max_iterations
(
0
);
// Now we loop over some different gamma values to see how good they are. Note
// Now we loop over some different gamma values to see how good they are. Note
// that this is a very simple way to try out a few possible parameter choices. You
// that this is a very simple way to try out a few possible parameter choices. You
// should look at the model_selection_ex.cpp program for examples of more sophisticated
// should look at the model_selection_ex.cpp program for examples of more sophisticated
...
...
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