Added a get_kernel() function to these objects. Also fixed some incorrect

parts of the specs.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402319
This commit is contained in:
Davis King 2008-06-15 15:08:01 +00:00
parent aad01becc4
commit 1e2a3615cf
6 changed files with 42 additions and 3 deletions

View File

@ -56,6 +56,12 @@ namespace dlib
return my_max_dictionary_size;
}
const kernel_type& get_kernel (
) const
{
return kernel;
}
void clear_dictionary ()
{
dictionary.clear();

View File

@ -58,11 +58,17 @@ namespace dlib
ensures
- this object is properly initialized
- #tolerance() == tolerance_
- #get_decision_function().kernel_function == kernel_
(i.e. this object will use the given kernel function)
- #get_kernel() == kernel_
- #max_dictionary_size() == max_dictionary_size_
!*/
const kernel_type& get_kernel (
) const;
/*!
ensures
- returns a const reference to the kernel used by this object
!*/
unsigned long max_dictionary_size(
) const;
/*!

View File

@ -39,6 +39,12 @@ namespace dlib
{
}
const kernel_type& get_kernel (
) const
{
return kc.get_kernel();
}
void set_kcentroid (
const kcentroid<kernel_type>& kc_
)
@ -92,7 +98,7 @@ namespace dlib
// make sure requires clause is not broken
DLIB_ASSERT(samples.nc() == 1 && initial_centers.nc() == 1 &&
initial_centers.nr() == number_of_centers(),
initial_centers.nr() == static_cast<long>(number_of_centers()),
"\tvoid kkmeans::train()"
<< "\n\tInvalid arguments to this function"
<< "\n\tthis: " << this

View File

@ -71,6 +71,13 @@ namespace dlib
by the k-means clustering algorithm.
!*/
const kernel_type& get_kernel (
) const;
/*!
ensures
- returns a const reference to the kernel used by this object
!*/
void set_number_of_centers (
unsigned long num
);

View File

@ -51,6 +51,12 @@ namespace dlib
return my_max_dictionary_size;
}
const kernel_type& get_kernel (
) const
{
return kernel;
}
void clear_dictionary ()
{
dictionary.clear();

View File

@ -58,6 +58,7 @@ namespace dlib
- #tolerance() == tolerance_
- #get_decision_function().kernel_function == kernel_
(i.e. this object will use the given kernel function)
- #get_kernel() == kernel_
- #max_dictionary_size() == max_dictionary_size_
!*/
@ -74,6 +75,13 @@ namespace dlib
less accurate decision function but also in less support vectors.
!*/
const kernel_type& get_kernel (
) const;
/*!
ensures
- returns a const reference to the kernel used by this object
!*/
unsigned long max_dictionary_size(
) const;
/*!