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
8fd4b970
Commit
8fd4b970
authored
Oct 05, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the ability to get the score in addition to the label out of the
one_vs_all_decision_function.
parent
d6f0fd37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
one_vs_all_decision_function.h
dlib/svm/one_vs_all_decision_function.h
+16
-3
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
...
@@ -79,12 +79,12 @@ namespace dlib
return
num_classes
;
return
num_classes
;
}
}
result_type
operator
()
(
std
::
pair
<
result_type
,
scalar_type
>
predict
(
const
sample_type
&
sample
const
sample_type
&
sample
)
const
)
const
{
{
DLIB_ASSERT
(
number_of_classes
()
!=
0
,
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
You can't make predictions with an empty decision function."
<<
"
\n\t
this: "
<<
this
<<
"
\n\t
this: "
<<
this
);
);
...
@@ -104,7 +104,20 @@ namespace dlib
...
@@ -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
...
@@ -134,6 +134,20 @@ namespace dlib
this object)
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
()
(
result_type
operator
()
(
const
sample_type
&
sample
const
sample_type
&
sample
)
const
)
const
...
@@ -141,8 +155,8 @@ namespace dlib
...
@@ -141,8 +155,8 @@ namespace dlib
requires
requires
- number_of_classes() != 0
- number_of_classes() != 0
ensures
ensures
-
e
valuates all the decision functions in get_binary_decision_functions()
-
E
valuates all the decision functions in get_binary_decision_functions()
and returns the predicted label.
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