diff --git a/dlib/svm/ranking_tools.h b/dlib/svm/ranking_tools.h index 6aa344c70..da06004f4 100644 --- a/dlib/svm/ranking_tools.h +++ b/dlib/svm/ranking_tools.h @@ -243,6 +243,20 @@ namespace dlib return static_cast(total_pairs - total_wrong) / total_pairs; } +// ---------------------------------------------------------------------------------------- + + template < + typename ranking_function, + typename T + > + double test_ranking_function ( + const ranking_function& funct, + const ranking_pair& sample + ) + { + return test_ranking_function(funct, std::vector >(1,sample)); + } + // ---------------------------------------------------------------------------------------- template < diff --git a/dlib/svm/ranking_tools_abstract.h b/dlib/svm/ranking_tools_abstract.h index 77d5e267f..370ade85e 100644 --- a/dlib/svm/ranking_tools_abstract.h +++ b/dlib/svm/ranking_tools_abstract.h @@ -178,6 +178,28 @@ namespace dlib (for all valid i,j,k) !*/ +// ---------------------------------------------------------------------------------------- + + template < + typename ranking_function, + typename T + > + double test_ranking_function ( + const ranking_function& funct, + const ranking_pair& sample + ); + /*! + requires + - is_ranking_problem(std::vector >(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 >(1, sample)); + !*/ + // ---------------------------------------------------------------------------------------- template < diff --git a/dlib/svm/svm_rank_trainer_abstract.h b/dlib/svm/svm_rank_trainer_abstract.h index 8921dd376..22617ffff 100644 --- a/dlib/svm/svm_rank_trainer_abstract.h +++ b/dlib/svm/svm_rank_trainer_abstract.h @@ -218,9 +218,9 @@ namespace dlib - is_ranking_problem(std::vector >(1, sample)) == true ensures - This is just a convenience routine for calling the above train() - function. That is, it just copies sample into an appropriate std::vector - object and invokes the above train() method. That is, this function is - equivalent to invoking: + function. That is, it just copies sample into a std::vector object and + invokes the above train() method. This means that calling this function + is equivalent to invoking: return train(std::vector >(1, sample)); !*/