Found more places that confusingly refer to general basis vectors

as support vectors.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403310
This commit is contained in:
Davis King 2009-12-05 20:10:15 +00:00
parent ea67271ac2
commit 11944d0f05
2 changed files with 54 additions and 54 deletions

View File

@ -32,20 +32,20 @@ namespace dlib
typedef typename trainer_type::trained_function_type trained_function_type;
reduced_decision_function_trainer (
) :num_sv(0) {}
) :num_bv(0) {}
reduced_decision_function_trainer (
const trainer_type& trainer_,
const unsigned long num_sv_
const unsigned long num_sb_
) :
trainer(trainer_),
num_sv(num_sv_)
num_bv(num_sb_)
{
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0,
DLIB_ASSERT(num_bv > 0,
"\t reduced_decision_function_trainer()"
<< "\n\t you have given invalid arguments to this function"
<< "\n\t num_sv: " << num_sv
<< "\n\t num_bv: " << num_bv
);
}
@ -59,10 +59,10 @@ namespace dlib
) const
{
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0,
DLIB_ASSERT(num_bv > 0,
"\t reduced_decision_function_trainer::train(x,y)"
<< "\n\t You have tried to use an uninitialized version of this object"
<< "\n\t num_sv: " << num_sv );
<< "\n\t num_bv: " << num_bv );
return do_train(vector_to_matrix(x), vector_to_matrix(y));
}
@ -82,8 +82,8 @@ namespace dlib
// get the decision function object we are going to try and approximate
const decision_function<kernel_type> dec_funct = trainer.train(x,y);
// now find a linearly independent subset of the training points of num_sv points.
linearly_independent_subset_finder<kernel_type> lisf(dec_funct.kernel_function, num_sv);
// now find a linearly independent subset of the training points of num_bv points.
linearly_independent_subset_finder<kernel_type> lisf(dec_funct.kernel_function, num_bv);
for (long i = 0; i < x.nr(); ++i)
{
lisf.add(x(i));
@ -145,7 +145,7 @@ namespace dlib
// ------------------------------------------------------------------------------------
trainer_type trainer;
unsigned long num_sv;
unsigned long num_bv;
}; // end of class reduced_decision_function_trainer
@ -153,17 +153,17 @@ namespace dlib
template <typename trainer_type>
const reduced_decision_function_trainer<trainer_type> reduced (
const trainer_type& trainer,
const unsigned long num_sv
const unsigned long num_bv
)
{
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0,
DLIB_ASSERT(num_bv > 0,
"\tconst reduced_decision_function_trainer reduced()"
<< "\n\t you have given invalid arguments to this function"
<< "\n\t num_sv: " << num_sv
<< "\n\t num_bv: " << num_bv
);
return reduced_decision_function_trainer<trainer_type>(trainer, num_sv);
return reduced_decision_function_trainer<trainer_type>(trainer, num_bv);
}
// ----------------------------------------------------------------------------------------
@ -183,23 +183,23 @@ namespace dlib
typedef typename trainer_type::mem_manager_type mem_manager_type;
typedef typename trainer_type::trained_function_type trained_function_type;
reduced_decision_function_trainer2 () : num_sv(0) {}
reduced_decision_function_trainer2 () : num_bv(0) {}
reduced_decision_function_trainer2 (
const trainer_type& trainer_,
const long num_sv_,
const long num_sb_,
const double eps_ = 1e-3
) :
trainer(trainer_),
num_sv(num_sv_),
num_bv(num_sb_),
eps(eps_)
{
COMPILE_TIME_ASSERT(is_matrix<sample_type>::value);
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0 && eps > 0,
DLIB_ASSERT(num_bv > 0 && eps > 0,
"\t reduced_decision_function_trainer2()"
<< "\n\t you have given invalid arguments to this function"
<< "\n\t num_sv: " << num_sv
<< "\n\t num_bv: " << num_bv
<< "\n\t eps: " << eps
);
}
@ -214,10 +214,10 @@ namespace dlib
) const
{
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0,
DLIB_ASSERT(num_bv > 0,
"\t reduced_decision_function_trainer2::train(x,y)"
<< "\n\t You have tried to use an uninitialized version of this object"
<< "\n\t num_sv: " << num_sv );
<< "\n\t num_bv: " << num_bv );
return do_train(vector_to_matrix(x), vector_to_matrix(y));
}
@ -494,8 +494,8 @@ namespace dlib
// get the decision function object we are going to try and approximate
const decision_function<kernel_type> dec_funct = trainer.train(x,y);
// now find a linearly independent subset of the training points of num_sv points.
linearly_independent_subset_finder<kernel_type> lisf(dec_funct.kernel_function, num_sv);
// now find a linearly independent subset of the training points of num_bv points.
linearly_independent_subset_finder<kernel_type> lisf(dec_funct.kernel_function, num_bv);
for (long i = 0; i < x.nr(); ++i)
{
lisf.add(x(i));
@ -596,7 +596,7 @@ namespace dlib
// ------------------------------------------------------------------------------------
trainer_type trainer;
long num_sv;
long num_bv;
double eps;
@ -605,21 +605,21 @@ namespace dlib
template <typename trainer_type>
const reduced_decision_function_trainer2<trainer_type> reduced2 (
const trainer_type& trainer,
const long num_sv,
const long num_bv,
double eps = 1e-3
)
{
COMPILE_TIME_ASSERT(is_matrix<typename trainer_type::sample_type>::value);
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0 && eps > 0,
DLIB_ASSERT(num_bv > 0 && eps > 0,
"\tconst reduced_decision_function_trainer2 reduced2()"
<< "\n\t you have given invalid arguments to this function"
<< "\n\t num_sv: " << num_sv
<< "\n\t num_bv: " << num_bv
<< "\n\t eps: " << eps
);
return reduced_decision_function_trainer2<trainer_type>(trainer, num_sv, eps);
return reduced_decision_function_trainer2<trainer_type>(trainer, num_bv, eps);
}
// ----------------------------------------------------------------------------------------

View File

@ -26,12 +26,12 @@ namespace dlib
- trainer_type == some kind of batch trainer object (e.g. svm_nu_trainer)
WHAT THIS OBJECT REPRESENTS
This object represents an implementation of a reduced set algorithm
for support vector decision functions. This object acts as a post
processor for anything that creates decision_function objects. It
wraps another trainer object and performs this reduced set post
processing with the goal of representing the original decision
function in a form that involves fewer support vectors.
This object represents an implementation of a reduced set algorithm.
This object acts as a post processor for anything that creates
decision_function objects. It wraps another trainer object and
performs this reduced set post processing with the goal of
representing the original decision function in a form that
involves fewer basis vectors.
!*/
public:
@ -52,17 +52,17 @@ namespace dlib
reduced_decision_function_trainer (
const trainer_type& trainer,
const unsigned long num_sv
const unsigned long num_bv
);
/*!
requires
- num_sv > 0
- num_bv > 0
ensures
- returns a trainer object that applies post processing to the decision_function
objects created by the given trainer object with the goal of creating
decision_function objects with fewer support vectors.
decision_function objects with fewer basis vectors.
- The reduced decision functions that are output will have at most
num_sv support vectors.
num_bv basis vectors.
!*/
template <
@ -92,11 +92,11 @@ namespace dlib
>
const reduced_decision_function_trainer<trainer_type> reduced (
const trainer_type& trainer,
const unsigned long num_sv
) { return reduced_decision_function_trainer<trainer_type>(trainer, num_sv); }
const unsigned long num_bv
) { return reduced_decision_function_trainer<trainer_type>(trainer, num_bv); }
/*!
requires
- num_sv > 0
- num_bv > 0
- trainer_type == some kind of batch trainer object that creates decision_function
objects (e.g. svm_nu_trainer)
ensures
@ -120,12 +120,12 @@ namespace dlib
- kernel_derivative<trainer_type::kernel_type> must be defined
WHAT THIS OBJECT REPRESENTS
This object represents an implementation of a reduced set algorithm
for support vector decision functions. This object acts as a post
processor for anything that creates decision_function objects. It
wraps another trainer object and performs this reduced set post
processing with the goal of representing the original decision
function in a form that involves fewer support vectors.
This object represents an implementation of a reduced set algorithm.
This object acts as a post processor for anything that creates
decision_function objects. It wraps another trainer object and
performs this reduced set post processing with the goal of
representing the original decision function in a form that
involves fewer basis vectors.
This object's implementation is the same as that in the above
reduced_decision_function_trainer object except it also performs
@ -152,19 +152,19 @@ namespace dlib
reduced_decision_function_trainer2 (
const trainer_type& trainer,
const unsigned long num_sv,
const unsigned long num_bv,
double eps = 1e-3
);
/*!
requires
- num_sv > 0
- num_bv > 0
- eps > 0
ensures
- returns a trainer object that applies post processing to the decision_function
objects created by the given trainer object with the goal of creating
decision_function objects with fewer support vectors.
decision_function objects with fewer basis vectors.
- The reduced decision functions that are output will have at most
num_sv support vectors.
num_bv basis vectors.
- the gradient based optimization will continue until the change in the
objective function is less than eps. So smaller values of eps will
give better results but take longer to compute.
@ -197,12 +197,12 @@ namespace dlib
>
const reduced_decision_function_trainer2<trainer_type> reduced2 (
const trainer_type& trainer,
const unsigned long num_sv,
const unsigned long num_bv,
double eps = 1e-3
) { return reduced_decision_function_trainer2<trainer_type>(trainer, num_sv, eps); }
) { return reduced_decision_function_trainer2<trainer_type>(trainer, num_bv, eps); }
/*!
requires
- num_sv > 0
- num_bv > 0
- trainer_type == some kind of batch trainer object that creates decision_function
objects (e.g. svm_nu_trainer)
- kernel_derivative<trainer_type::kernel_type> is defined