Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
700ea34e
Commit
700ea34e
authored
Oct 30, 2011
by
Davis King
Browse files
Added the is_sequence_labeling_problem() routine.
parent
5ad3106c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
dlib/svm/svm.h
dlib/svm/svm.h
+23
-0
dlib/svm/svm_abstract.h
dlib/svm/svm_abstract.h
+17
-0
No files found.
dlib/svm/svm.h
View file @
700ea34e
...
@@ -175,6 +175,29 @@ namespace dlib
...
@@ -175,6 +175,29 @@ namespace dlib
vector_to_matrix
(
y_test
));
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
<
template
<
...
...
dlib/svm/svm_abstract.h
View file @
700ea34e
...
@@ -62,6 +62,23 @@ namespace dlib
...
@@ -62,6 +62,23 @@ namespace dlib
- x_labels(i) == -1 or +1
- 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)
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment