Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
e5ef72c4
Commit
e5ef72c4
authored
Apr 29, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refined function contract a little.
parent
84523a05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
structural_svm_potts_problem.h
dlib/svm/structural_svm_potts_problem.h
+20
-7
No files found.
dlib/svm/structural_svm_potts_problem.h
View file @
e5ef72c4
...
...
@@ -20,30 +20,43 @@ namespace dlib
// ----------------------------------------------------------------------------------------
template
<
typename
graph_type
>
bool
is_potts_problem
(
template
<
typename
graph_type
>
bool
is_potts_learning_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
c
olumn vectors or is
some kind of sparse vector type.
- graph_type::
type and graph_type::edge_type are either dlib::matrix types
c
apable of containing column vectors or
some kind of sparse vector type.
ensures
- returns true if all of the following are true and false otherwise:
- Note that a potts learning problem is a task to learn a binary classifier which
predicts the correct label for each node in the provided graphs. Additionally,
we have information in the form of graph edges between nodes where edges are
present when we believe the linked nodes are likely to have the same label.
Therefore, part of a potts learning problem is to learn to score each edge in
terms of how strongly the edge should enforce labeling consistency between
its two nodes. Thus, to be a valid potts problem, samples should contain
example graphs of connected nodes while labels should indicate the desired
label of each node. The precise requirements for a valid potts learning
problem are listed below.
- This function 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:
- graph_contains_length_one_cycle(samples[i]) == false
- 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
.)
(However, edge vectors may differ in dimension from node vectors.)
- All vectors have non-zero size. That is, they have more than 0 dimensions.
!*/
{
...
...
@@ -108,7 +121,7 @@ namespace dlib
labels
(
labels_
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
is_potts_problem
(
samples
,
labels
)
==
true
,
DLIB_ASSERT
(
is_potts_
learning_
problem
(
samples
,
labels
)
==
true
,
"
\t
structural_svm_potts_problem::structural_svm_potts_problem()"
<<
"
\n\t
invalid inputs were given to this function"
);
...
...
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