Added the is_sequence_labeling_problem() routine.

This commit is contained in:
Davis King 2011-10-30 13:05:58 -04:00
parent 5ad3106c7f
commit 700ea34e69
2 changed files with 40 additions and 0 deletions

View File

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

View File

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