Commit 700ea34e authored by Davis King's avatar Davis King

Added the is_sequence_labeling_problem() routine.

parent 5ad3106c
......@@ -175,6 +175,29 @@ namespace dlib
vector_to_matrix(y_test));
}
// ----------------------------------------------------------------------------------------
template <
typename sample_type
>
bool is_sequence_labeling_problem (
const std::vector<std::vector<sample_type> >& samples,
const std::vector<std::vector<unsigned long> >& labels
)
{
if (is_learning_problem(samples, labels))
{
for (unsigned long i = 0; i < samples.size(); ++i)
{
if (samples[i].size() != labels[i].size())
return false;
}
return true;
}
return false;
}
// ----------------------------------------------------------------------------------------
template <
......
......@@ -62,6 +62,23 @@ namespace dlib
- x_labels(i) == -1 or +1
!*/
template <
typename sample_type
>
bool is_sequence_labeling_problem (
const std::vector<std::vector<sample_type> >& samples,
const std::vector<std::vector<unsigned long> >& labels
);
/*!
ensures
- returns true if all of the following are true and false otherwise:
- is_learning_problem(samples, labels) == true
- for all valid i:
- samples[i].size() == labels[i].size()
(i.e. The size of a label sequence need to match the size of
its corresponding sample sequence)
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
......
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