Commit d6f0fd37 authored by Davis King's avatar Davis King

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

multiclass_linear_decision_function.
parent 10dec05a
......@@ -778,7 +778,7 @@ namespace dlib
unsigned long number_of_classes (
) const { return labels.size(); }
result_type operator() (
std::pair<result_type, scalar_type> predict (
const sample_type& x
) const
{
......@@ -798,7 +798,14 @@ namespace dlib
}
}
return labels[best_idx];
return std::make_pair(labels[best_idx], best_val);
}
result_type operator() (
const sample_type& x
) const
{
return predict(x).first;
}
};
......
......@@ -927,6 +927,23 @@ namespace dlib
this object)
!*/
std::pair<result_type, scalar_type> predict (
const sample_type& x
) const;
/*!
requires
- weights.size() > 0
- weights.nr() == number_of_classes() == b.size()
- if (x is a dense vector, i.e. a dlib::matrix) then
- is_vector(x) == true
- x.size() == weights.nc()
(i.e. it must be legal to multiply weights with x)
ensures
- Returns the predicted label for the x sample and also it's score.
In particular, it returns the following:
std::make_pair(labels[index_of_max(weights*x-b)], max(weights*x-b))
!*/
result_type operator() (
const sample_type& x
) const;
......@@ -942,6 +959,7 @@ namespace dlib
- Returns the predicted label for the x sample. In particular, it returns
the following:
labels[index_of_max(weights*x-b)]
Or in other words, this function returns predict(x).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