"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "11f7d6f3cc07ed305c162d96bcdddb2ee6802832"
Commit 8fd4b970 authored by Davis King's avatar Davis King
Browse files

Added the ability to get the score in addition to the label out of the

one_vs_all_decision_function.
parent d6f0fd37
...@@ -79,12 +79,12 @@ namespace dlib ...@@ -79,12 +79,12 @@ namespace dlib
return num_classes; return num_classes;
} }
result_type operator() ( std::pair<result_type, scalar_type> predict (
const sample_type& sample const sample_type& sample
) const ) const
{ {
DLIB_ASSERT(number_of_classes() != 0, DLIB_ASSERT(number_of_classes() != 0,
"\t void one_vs_all_decision_function::operator()" "\t pair<result_type,scalar_type> one_vs_all_decision_function::predict()"
<< "\n\t You can't make predictions with an empty decision function." << "\n\t You can't make predictions with an empty decision function."
<< "\n\t this: " << this << "\n\t this: " << this
); );
...@@ -104,7 +104,20 @@ namespace dlib ...@@ -104,7 +104,20 @@ namespace dlib
} }
} }
return best_label; return std::make_pair(best_label, best_score);
}
result_type operator() (
const sample_type& sample
) const
{
DLIB_ASSERT(number_of_classes() != 0,
"\t result_type one_vs_all_decision_function::operator()"
<< "\n\t You can't make predictions with an empty decision function."
<< "\n\t this: " << this
);
return predict(sample).first;
} }
......
...@@ -134,6 +134,20 @@ namespace dlib ...@@ -134,6 +134,20 @@ namespace dlib
this object) this object)
!*/ !*/
std::pair<result_type, scalar_type> predict (
const sample_type& sample
) const;
/*!
requires
- number_of_classes() != 0
ensures
- Evaluates all the decision functions in get_binary_decision_functions()
and returns the predicted label and score for the input sample. That is,
returns std::make_pair(label,score)
- The label is determined by whichever classifier outputs the largest
score.
!*/
result_type operator() ( result_type operator() (
const sample_type& sample const sample_type& sample
) const ) const
...@@ -141,8 +155,8 @@ namespace dlib ...@@ -141,8 +155,8 @@ namespace dlib
requires requires
- number_of_classes() != 0 - number_of_classes() != 0
ensures ensures
- evaluates all the decision functions in get_binary_decision_functions() - Evaluates all the decision functions in get_binary_decision_functions()
and returns the predicted label. and returns the predicted label. That is, returns predict(sample).first.
!*/ !*/
}; };
......
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