Commit 1e2a3615 authored by Davis King's avatar Davis King

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
parent aad01bec
...@@ -56,6 +56,12 @@ namespace dlib ...@@ -56,6 +56,12 @@ namespace dlib
return my_max_dictionary_size; return my_max_dictionary_size;
} }
const kernel_type& get_kernel (
) const
{
return kernel;
}
void clear_dictionary () void clear_dictionary ()
{ {
dictionary.clear(); dictionary.clear();
......
...@@ -58,11 +58,17 @@ namespace dlib ...@@ -58,11 +58,17 @@ namespace dlib
ensures ensures
- this object is properly initialized - this object is properly initialized
- #tolerance() == tolerance_ - #tolerance() == tolerance_
- #get_decision_function().kernel_function == kernel_ - #get_kernel() == kernel_
(i.e. this object will use the given kernel function)
- #max_dictionary_size() == max_dictionary_size_ - #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( unsigned long max_dictionary_size(
) const; ) const;
/*! /*!
......
...@@ -39,6 +39,12 @@ namespace dlib ...@@ -39,6 +39,12 @@ namespace dlib
{ {
} }
const kernel_type& get_kernel (
) const
{
return kc.get_kernel();
}
void set_kcentroid ( void set_kcentroid (
const kcentroid<kernel_type>& kc_ const kcentroid<kernel_type>& kc_
) )
...@@ -92,7 +98,7 @@ namespace dlib ...@@ -92,7 +98,7 @@ namespace dlib
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(samples.nc() == 1 && initial_centers.nc() == 1 && 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()" "\tvoid kkmeans::train()"
<< "\n\tInvalid arguments to this function" << "\n\tInvalid arguments to this function"
<< "\n\tthis: " << this << "\n\tthis: " << this
......
...@@ -71,6 +71,13 @@ namespace dlib ...@@ -71,6 +71,13 @@ namespace dlib
by the k-means clustering algorithm. 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 ( void set_number_of_centers (
unsigned long num unsigned long num
); );
......
...@@ -51,6 +51,12 @@ namespace dlib ...@@ -51,6 +51,12 @@ namespace dlib
return my_max_dictionary_size; return my_max_dictionary_size;
} }
const kernel_type& get_kernel (
) const
{
return kernel;
}
void clear_dictionary () void clear_dictionary ()
{ {
dictionary.clear(); dictionary.clear();
......
...@@ -58,6 +58,7 @@ namespace dlib ...@@ -58,6 +58,7 @@ namespace dlib
- #tolerance() == tolerance_ - #tolerance() == tolerance_
- #get_decision_function().kernel_function == kernel_ - #get_decision_function().kernel_function == kernel_
(i.e. this object will use the given kernel function) (i.e. this object will use the given kernel function)
- #get_kernel() == kernel_
- #max_dictionary_size() == max_dictionary_size_ - #max_dictionary_size() == max_dictionary_size_
!*/ !*/
...@@ -74,6 +75,13 @@ namespace dlib ...@@ -74,6 +75,13 @@ namespace dlib
less accurate decision function but also in less support vectors. 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( unsigned long max_dictionary_size(
) const; ) const;
/*! /*!
......
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