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
84523a05
Commit
84523a05
authored
Apr 29, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added initial sketch of a potts learning problem definition.
parent
5e9df653
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
+38
-4
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