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
7e5cc9b7
"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "94b332c47665cb85b22a54545d7fb7f6478ea72d"
Commit
7e5cc9b7
authored
Apr 30, 2012
by
Davis King
Browse files
Filled out spec file
parent
a0c3c224
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
dlib/svm/cross_validate_graph_labeling_trainer_abstract.h
dlib/svm/cross_validate_graph_labeling_trainer_abstract.h
+80
-0
No files found.
dlib/svm/cross_validate_graph_labeling_trainer_abstract.h
View file @
7e5cc9b7
// Copyright (C) 2012 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_CROSS_VALIDATE_GRAPh_LABELING_TRAINER_ABSTRACT_H__
#ifdef DLIB_CROSS_VALIDATE_GRAPh_LABELING_TRAINER_ABSTRACT_H__
#include "../array/array_kernel_abstract.h"
#include <vector>
#include "../matrix/matrix_abstract.h"
namespace
dlib
{
// ----------------------------------------------------------------------------------------
template
<
typename
graph_labeler
,
typename
graph_type
>
matrix
<
double
,
1
,
2
>
test_graph_labeling_function
(
const
graph_labeler
&
labeler
,
const
dlib
::
array
<
graph_type
>&
samples
,
const
std
::
vector
<
std
::
vector
<
node_label
>
>&
labels
);
/*!
requires
- is_graph_labeling_problem(samples,labels) == true
- graph_labeler == an object with an interface compatible with the
dlib::graph_labeler object.
- the following must be a valid expression: labeler(samples[0]);
ensures
- This function tests the accuracy of the given graph labeler against
the sample graphs and their associated labels. In particular, this
function returns a matrix R such that:
- R(0) == The fraction of nodes which are supposed to have a label of
true that are labeled as such by the labeler.
- R(1) == The fraction of nodes which are supposed to have a label of
false that are labeled as such by the labeler.
Therefore, if R is [1,1] then the labeler makes perfect predictions while
an R of [0,0] indicates that it gets everything wrong.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
trainer_type
,
typename
graph_type
>
matrix
<
double
,
1
,
2
>
cross_validate_graph_labeling_trainer
(
const
trainer_type
&
trainer
,
const
dlib
::
array
<
graph_type
>&
samples
,
const
std
::
vector
<
std
::
vector
<
node_label
>
>&
labels
,
const
long
folds
);
/*!
requires
- is_graph_labeling_problem(samples,labels) == true
- 1 < folds <= samples.size()
- trainer_type == an object which trains some kind of graph labeler object
(e.g. structural_graph_labeling_trainer)
ensures
- performs k-fold cross validation by using the given trainer to solve the
given graph labeling problem for the given number of folds. Each fold
is tested using the output of the trainer and the average classification
accuracy from all folds is returned. In particular, this function returns
a matrix R such that:
- R(0) == The fraction of nodes which are supposed to have a label of
true that are labeled as such by the learned labeler.
- R(1) == The fraction of nodes which are supposed to have a label of
false that are labeled as such by the learned labeler.
Therefore, if R is [1,1] then the labeler makes perfect predictions while
an R of [0,0] indicates that it gets everything wrong.
- The number of folds used is given by the folds argument.
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_CROSS_VALIDATE_GRAPh_LABELING_TRAINER_ABSTRACT_H__
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