Commit 7ef8e93b authored by Davis King's avatar Davis King

Made spec more clear

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403679
parent 51f8777e
...@@ -93,20 +93,8 @@ namespace dlib ...@@ -93,20 +93,8 @@ namespace dlib
) const; ) const;
/*! /*!
ensures ensures
- returns the minimum tolerance to use for the approximately linearly dependent - returns the minimum projection error necessary to include a sample point
test used for dictionary vector selection (see KRLS paper for ALD details). into the dictionary.
In other words, this is the minimum threshold for how linearly independent
a sample must be for it to be considered for addition to the dictionary.
Moreover, bigger values of this field will make the algorithm run faster but
might give less accurate results.
- The exact meaning of the tolerance parameter is the following:
Imagine that we have an empirical_kernel_map that contains all the current
dictionary vectors. Then the tolerance is the minimum projection error
(as given by empirical_kernel_map::project()) required to cause us to
include a new vector in the dictionary. So each time you call add() this
object basically just computes the projection error for that new sample
and if it is larger than the tolerance then that new sample becomes part
of the dictionary.
!*/ !*/
void set_minimum_tolerance ( void set_minimum_tolerance (
...@@ -131,18 +119,34 @@ namespace dlib ...@@ -131,18 +119,34 @@ namespace dlib
); );
/*! /*!
ensures ensures
- if (x is sufficiently linearly independent of the vectors already in this object) then - if (dictionary_size() < max_dictionary_size() then
- adds x into the dictionary - if (projection_error(x) > minimum_tolerance()) then
- (*this)[#dictionary_size()-1] == x - adds x into the dictionary
- returns true - (*this)[#dictionary_size()-1] == x
- if (dictionary_size() < max_dictionary_size()) then
- #dictionary_size() == dictionary_size() + 1 - #dictionary_size() == dictionary_size() + 1
- returns true
- else - else
- #dictionary_size() == dictionary_size() - the dictionary is not changed
(i.e. the number of vectors in this object doesn't change) - returns false
- the least linearly independent vector in this object is removed
- else - else
- returns false - #dictionary_size() == dictionary_size()
(i.e. the number of vectors in this object doesn't change)
- since the dictionary is full adding a new element means we have to
remove one of the current ones. So let proj_error[i] be equal to the
projection error obtained when projecting dictionary vector (*this)[i]
onto the other elements of the dictionary. Then let min_proj_error
be equal to the minimum value in proj_error. The dictionary element
with the minimum projection error is the "least linearly independent"
vector in the dictionary and is the one which will be removed to make
room for a new element.
- if (projection_error(x) > minimum_tolerance() && projection_error(x) > min_proj_error)
- the least linearly independent vector in this object is removed
- adds x into the dictionary
- (*this)[#dictionary_size()-1] == x
- returns true
- else
- the dictionary is not changed
- returns false
!*/ !*/
scalar_type projection_error ( scalar_type projection_error (
...@@ -156,7 +160,7 @@ namespace dlib ...@@ -156,7 +160,7 @@ namespace dlib
projection_error argument when the ekm is loaded with the dictionary projection_error argument when the ekm is loaded with the dictionary
vectors.) vectors.)
- Note that if the dictionary is empty then the return value is - Note that if the dictionary is empty then the return value is
equal to get_kernel(x,x). equal to get_kernel()(x,x).
!*/ !*/
void swap ( void swap (
......
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