mirror of https://github.com/davisking/dlib.git
merged changes and updated abstract file.
This commit is contained in:
commit
2821926236
|
@ -147,10 +147,23 @@ namespace dlib
|
|||
typedef decision_function<kernel_type> trained_function_type;
|
||||
|
||||
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 (
|
||||
scalar_type eps_
|
||||
)
|
||||
|
@ -288,9 +301,11 @@ namespace dlib
|
|||
bool search_all_alphas = false;
|
||||
unsigned long ticker = 0;
|
||||
const unsigned long rounds_of_narrow_search = 100;
|
||||
unsigned long iterations = 0;
|
||||
|
||||
while (true)
|
||||
while (iterations != max_iterations)
|
||||
{
|
||||
iterations++;
|
||||
if (recompute_beta)
|
||||
{
|
||||
// calculate the current t_estimate. (this is the predicted t value for each sample according to the
|
||||
|
@ -572,6 +587,7 @@ namespace dlib
|
|||
// private member variables
|
||||
kernel_type kernel;
|
||||
scalar_type eps;
|
||||
unsigned long max_iterations;
|
||||
|
||||
const static scalar_type tau;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace dlib
|
|||
- This object is properly initialized and ready to be used
|
||||
to train a relevance vector machine.
|
||||
- #get_epsilon() == 0.001
|
||||
- #get_max_iterations() == 2000
|
||||
!*/
|
||||
|
||||
void set_epsilon (
|
||||
|
@ -86,6 +87,22 @@ namespace dlib
|
|||
- 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 <
|
||||
typename in_sample_vector_type,
|
||||
typename in_scalar_vector_type
|
||||
|
|
|
@ -103,6 +103,9 @@ int main()
|
|||
// stopping epsilon bigger. However, this might make the outputs less
|
||||
// reliable. But sometimes it works out well. 0.001 is the default.
|
||||
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
|
||||
// that this is a very simple way to try out a few possible parameter choices. You
|
||||
|
|
Loading…
Reference in New Issue