Added another overload of test_ranking_function() that takes a single

ranking_pair.  Also improved wording of comment in svm_rank_trainer_abstract.h
This commit is contained in:
Davis King 2012-11-23 15:44:57 -05:00
parent 41d47e98e0
commit ee3a8692bf
3 changed files with 39 additions and 3 deletions

View File

@ -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 <

View File

@ -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 <

View File

@ -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));
!*/ !*/