Commit ee3a8692 authored by Davis King's avatar Davis King

Added another overload of test_ranking_function() that takes a single

ranking_pair.  Also improved wording of comment in svm_rank_trainer_abstract.h
parent 41d47e98
...@@ -243,6 +243,20 @@ namespace dlib ...@@ -243,6 +243,20 @@ namespace dlib
return static_cast<double>(total_pairs - total_wrong) / total_pairs; return static_cast<double>(total_pairs - total_wrong) / total_pairs;
} }
// ----------------------------------------------------------------------------------------
template <
typename ranking_function,
typename T
>
double test_ranking_function (
const ranking_function& funct,
const ranking_pair<T>& sample
)
{
return test_ranking_function(funct, std::vector<ranking_pair<T> >(1,sample));
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
......
...@@ -178,6 +178,28 @@ namespace dlib ...@@ -178,6 +178,28 @@ namespace dlib
(for all valid i,j,k) (for all valid i,j,k)
!*/ !*/
// ----------------------------------------------------------------------------------------
template <
typename ranking_function,
typename T
>
double test_ranking_function (
const ranking_function& funct,
const ranking_pair<T>& sample
);
/*!
requires
- is_ranking_problem(std::vector<ranking_pair<T> >(1, sample)) == true
- ranking_function == some kind of decision function object (e.g. decision_function)
ensures
- This is just a convenience routine for calling the above
test_ranking_function() routine. That is, it just copies sample into a
std::vector object and invokes the above test_ranking_function() routine.
This means that calling this function is equivalent to invoking:
return test_ranking_function(funct, std::vector<ranking_pair<T> >(1, sample));
!*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
......
...@@ -218,9 +218,9 @@ namespace dlib ...@@ -218,9 +218,9 @@ namespace dlib
- is_ranking_problem(std::vector<ranking_pair<sample_type> >(1, sample)) == true - is_ranking_problem(std::vector<ranking_pair<sample_type> >(1, sample)) == true
ensures ensures
- This is just a convenience routine for calling the above train() - This is just a convenience routine for calling the above train()
function. That is, it just copies sample into an appropriate std::vector function. That is, it just copies sample into a std::vector object and
object and invokes the above train() method. That is, this function is invokes the above train() method. This means that calling this function
equivalent to invoking: is equivalent to invoking:
return train(std::vector<ranking_pair<sample_type> >(1, sample)); return train(std::vector<ranking_pair<sample_type> >(1, sample));
!*/ !*/
......
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