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
28219262
"docs/git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "c4d6929582c2739bc17f22faa76c19fb2973e36c"
Commit
28219262
authored
Apr 22, 2014
by
Davis King
Browse files
merged changes and updated abstract file.
parents
7bb67fc1
31078ade
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
dlib/svm/rvm.h
dlib/svm/rvm.h
+18
-2
dlib/svm/rvm_abstract.h
dlib/svm/rvm_abstract.h
+17
-0
examples/rvm_ex.cpp
examples/rvm_ex.cpp
+3
-0
No files found.
dlib/svm/rvm.h
View file @
28219262
...
@@ -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
(
unsigned
long
max_iterations_
)
{
{
max_iterations
=
max_iterations_
;
}
unsigned
long
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
;
unsigned
long
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
;
unsigned
long
max_iterations
;
const
static
scalar_type
tau
;
const
static
scalar_type
tau
;
...
...
dlib/svm/rvm_abstract.h
View file @
28219262
...
@@ -50,6 +50,7 @@ namespace dlib
...
@@ -50,6 +50,7 @@ namespace dlib
- This object is properly initialized and ready to be used
- This object is properly initialized and ready to be used
to train a relevance vector machine.
to train a relevance vector machine.
- #get_epsilon() == 0.001
- #get_epsilon() == 0.001
- #get_max_iterations() == 2000
!*/
!*/
void
set_epsilon
(
void
set_epsilon
(
...
@@ -86,6 +87,22 @@ namespace dlib
...
@@ -86,6 +87,22 @@ namespace dlib
- returns a copy of the kernel function in use by this object
- returns a copy of the kernel function in use by this object
!*/
!*/
unsigned
long
get_max_iterations
(
)
const
;
/*!
ensures
- returns the maximum number of iterations the RVM optimizer is allowed to
run before it is required to stop and return a result.
!*/
void
set_max_iterations
(
unsigned
long
max_iter
);
/*!
ensures
- #get_max_iterations() == max_iter
!*/
template
<
template
<
typename
in_sample_vector_type
,
typename
in_sample_vector_type
,
typename
in_scalar_vector_type
typename
in_scalar_vector_type
...
...
examples/rvm_ex.cpp
View file @
28219262
...
@@ -103,6 +103,9 @@ int main()
...
@@ -103,6 +103,9 @@ int main()
// stopping epsilon bigger. However, this might make the outputs less
// stopping epsilon bigger. However, this might make the outputs less
// 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
);
// You can also set an explicit limit on the number of iterations used by the numeric
// solver. The default is 2000.
trainer
.
set_max_iterations
(
2000
);
// 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
...
...
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