Commit 13ed137c authored by Davis King's avatar Davis King

Added a requires clause to the set_tolerance() member function and

renamed clear() to clear_dictionary().

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402249
parent 8e513302
......@@ -36,11 +36,18 @@ namespace dlib
kernel(kernel_),
tolerance(tolerance_)
{
clear();
clear_dictionary();
}
void set_tolerance (scalar_type tolerance_)
{
// make sure requires clause is not broken
DLIB_ASSERT(tolerance_ >= 0,
"\tvoid krls::set_tolerance"
<< "\n\tinvalid tolerance value"
<< "\n\ttolerance: " << tolerance_
<< "\n\tthis: " << this
);
tolerance = tolerance_;
}
......@@ -49,7 +56,7 @@ namespace dlib
return tolerance;
}
void clear ()
void clear_dictionary ()
{
dictionary.clear();
alpha.clear();
......
......@@ -56,6 +56,8 @@ namespace dlib
scalar_type tolerance_
);
/*!
requires
- tolerance_ >= 0
ensures
- #get_tolerance() == tolerance_
!*/
......@@ -73,15 +75,12 @@ namespace dlib
less accurate decision function but also in less support vectors.
!*/
void clear (
void clear_dictionary (
);
/*!
ensures
- clears out all learned data and puts this object back to its
initial state.
- clears out all learned data
(e.g. #get_decision_function().support_vectors.size() == 0)
- #get_tolerance() == get_tolerance()
(i.e. doesn't change the value of the tolerance)
!*/
scalar_type operator() (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment