Commit 8284d6b0 authored by Davis King's avatar Davis King

made the rank_features() function work with any kind of

vector like object

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402377
parent 8c79cdfe
...@@ -19,7 +19,7 @@ namespace dlib ...@@ -19,7 +19,7 @@ namespace dlib
typename sample_matrix_type, typename sample_matrix_type,
typename label_matrix_type typename label_matrix_type
> >
matrix<typename kernel_type::scalar_type,0,2,typename kernel_type::mem_manager_type> rank_features ( matrix<typename kernel_type::scalar_type,0,2,typename kernel_type::mem_manager_type> rank_features_impl (
const kcentroid<kernel_type>& kc, const kcentroid<kernel_type>& kc,
const sample_matrix_type& samples, const sample_matrix_type& samples,
const label_matrix_type& labels, const label_matrix_type& labels,
...@@ -131,6 +131,23 @@ namespace dlib ...@@ -131,6 +131,23 @@ namespace dlib
return results; return results;
} }
// ----------------------------------------------------------------------------------------
template <
typename kernel_type,
typename sample_matrix_type,
typename label_matrix_type
>
matrix<typename kernel_type::scalar_type,0,2,typename kernel_type::mem_manager_type> rank_features (
const kcentroid<kernel_type>& kc,
const sample_matrix_type& samples,
const label_matrix_type& labels,
const long num_features
)
{
return rank_features_impl(kc, vector_to_matrix(samples), vector_to_matrix(labels), num_features);
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
...@@ -27,12 +27,11 @@ namespace dlib ...@@ -27,12 +27,11 @@ namespace dlib
); );
/*! /*!
requires requires
- is_matrix<sample_matrix_type>::value == true - vector_to_matrix(samples) == a valid matrix object
(i.e. samples must be a dlib matrix object) - vector_to_matrix(samples(0)) == a valid matrix object
- is_matrix<sample_matrix_type::type>::value == true - vector_to_matrix(labels) == a valid matrix object
(i.e. samples must also contain dlib matrix objects) (i.e. the 3 above things must either be dlib::matrix objects or be
- is_matrix<label_matrix_type>::value == true convertable to them via the vector_to_matrix() function)
(i.e. labels must be a dlib matrix object)
- samples.nc() == 1 && labels.nc() == 1 - samples.nc() == 1 && labels.nc() == 1
(i.e. samples and labels must be column vectors) (i.e. samples and labels must be column vectors)
- samples.size() == labels.size() - samples.size() == labels.size()
......
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