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
84523a05
"tests/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "352ca3198cb25e6098f795568547075ff28e3133"
Commit
84523a05
authored
Apr 29, 2012
by
Davis King
Browse files
Added initial sketch of a potts learning problem definition.
parent
5e9df653
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
+38
-4
dlib/svm/structural_svm_potts_problem.h
dlib/svm/structural_svm_potts_problem.h
+38
-4
No files found.
dlib/svm/structural_svm_potts_problem.h
View file @
84523a05
...
@@ -17,6 +17,41 @@
...
@@ -17,6 +17,41 @@
namespace
dlib
namespace
dlib
{
{
// ----------------------------------------------------------------------------------------
template
<
typename
graph_type
>
bool
is_potts_problem
(
const
dlib
::
array
<
graph_type
>&
samples
,
const
std
::
vector
<
std
::
vector
<
node_label
>
>&
labels
)
/*!
requires
- graph_type is an implementation of dlib/graph/graph_kernel_abstract.h
- graph_type::edge_type is either a dlib::matrix capable of containing
column vectors or is some kind of sparse vector type.
ensures
- returns true if all of the following are true and false otherwise:
- is_learning_problem(samples, labels) == true
- All the vectors stored on the edges of each graph in samples
contain only values which are >= 0.
- graph_type::type and graph_type::edge_type either both represent
dlib::matrix column vectors or are both sparse vectors.
- for all valid i:
- samples[i].number_of_nodes() == labels[i].size()
(i.e. Every graph node gets its own label)
- if (graph_type::edge_type is a dlib::matrix) then
- All the nodes must contain vectors with the same number of dimensions.
- All the edges must contain vectors with the same number of dimensions.
(However, edge vectors may differ in dimension from node vectors though.)
- All vectors have non-zero size. That is, they have more than 0 dimensions.
!*/
{
return
true
;
}
// ----------------------------------------------------------------------------------------
namespace
impl
namespace
impl
{
{
template
<
template
<
...
@@ -73,10 +108,9 @@ namespace dlib
...
@@ -73,10 +108,9 @@ namespace dlib
labels
(
labels_
)
labels
(
labels_
)
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
// TODO
DLIB_ASSERT
(
is_potts_problem
(
samples
,
labels
)
==
true
,
// requires, at least one edge in the dataset. All edge vectors have same number
"
\t
structural_svm_potts_problem::structural_svm_potts_problem()"
// of dims. All node vectors have same number of dims. none of the dims can be 0.
<<
"
\n\t
invalid inputs were given to this function"
);
// all elements in a edge vector must be >= 0.
// Figure out how many dimensions are in a node vector. Just pick
// Figure out how many dimensions are in a node vector. Just pick
...
...
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