mirror of https://github.com/davisking/dlib.git
Added the is_sequence_labeling_problem() routine.
This commit is contained in:
parent
5ad3106c7f
commit
700ea34e69
|
@ -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)
|
||||
!*/
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue