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
8fd4b970
Commit
8fd4b970
authored
Oct 04, 2013
by
Davis King
Browse files
Added the ability to get the score in addition to the label out of the
one_vs_all_decision_function.
parent
d6f0fd37
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
dlib/svm/one_vs_all_decision_function.h
dlib/svm/one_vs_all_decision_function.h
+16
-3
dlib/svm/one_vs_all_decision_function_abstract.h
dlib/svm/one_vs_all_decision_function_abstract.h
+16
-2
No files found.
dlib/svm/one_vs_all_decision_function.h
View file @
8fd4b970
...
...
@@ -79,12 +79,12 @@ namespace dlib
return
num_classes
;
}
result_type
operator
()
(
std
::
pair
<
result_type
,
scalar_type
>
predict
(
const
sample_type
&
sample
)
const
{
DLIB_ASSERT
(
number_of_classes
()
!=
0
,
"
\t
void
one_vs_all_decision_function::
operator
()"
"
\t
pair<result_type,scalar_type>
one_vs_all_decision_function::
predict
()"
<<
"
\n\t
You can't make predictions with an empty decision function."
<<
"
\n\t
this: "
<<
this
);
...
...
@@ -104,7 +104,20 @@ namespace dlib
}
}
return
best_label
;
return
std
::
make_pair
(
best_label
,
best_score
);
}
result_type
operator
()
(
const
sample_type
&
sample
)
const
{
DLIB_ASSERT
(
number_of_classes
()
!=
0
,
"
\t
result_type one_vs_all_decision_function::operator()"
<<
"
\n\t
You can't make predictions with an empty decision function."
<<
"
\n\t
this: "
<<
this
);
return
predict
(
sample
).
first
;
}
...
...
dlib/svm/one_vs_all_decision_function_abstract.h
View file @
8fd4b970
...
...
@@ -134,6 +134,20 @@ namespace dlib
this object)
!*/
std
::
pair
<
result_type
,
scalar_type
>
predict
(
const
sample_type
&
sample
)
const
;
/*!
requires
- number_of_classes() != 0
ensures
- Evaluates all the decision functions in get_binary_decision_functions()
and returns the predicted label and score for the input sample. That is,
returns std::make_pair(label,score)
- The label is determined by whichever classifier outputs the largest
score.
!*/
result_type
operator
()
(
const
sample_type
&
sample
)
const
...
...
@@ -141,8 +155,8 @@ namespace dlib
requires
- number_of_classes() != 0
ensures
-
e
valuates all the decision functions in get_binary_decision_functions()
and returns the predicted label.
-
E
valuates all the decision functions in get_binary_decision_functions()
and returns the predicted label.
That is, returns predict(sample).first.
!*/
};
...
...
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