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
d6f0fd37
Commit
d6f0fd37
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
multiclass_linear_decision_function.
parent
10dec05a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
function.h
dlib/svm/function.h
+9
-2
function_abstract.h
dlib/svm/function_abstract.h
+18
-0
No files found.
dlib/svm/function.h
View file @
d6f0fd37
...
...
@@ -778,7 +778,7 @@ namespace dlib
unsigned
long
number_of_classes
(
)
const
{
return
labels
.
size
();
}
result_type
operator
()
(
std
::
pair
<
result_type
,
scalar_type
>
predict
(
const
sample_type
&
x
)
const
{
...
...
@@ -798,7 +798,14 @@ namespace dlib
}
}
return
labels
[
best_idx
];
return
std
::
make_pair
(
labels
[
best_idx
],
best_val
);
}
result_type
operator
()
(
const
sample_type
&
x
)
const
{
return
predict
(
x
).
first
;
}
};
...
...
dlib/svm/function_abstract.h
View file @
d6f0fd37
...
...
@@ -927,6 +927,23 @@ namespace dlib
this object)
!*/
std
::
pair
<
result_type
,
scalar_type
>
predict
(
const
sample_type
&
x
)
const
;
/*!
requires
- weights.size() > 0
- weights.nr() == number_of_classes() == b.size()
- if (x is a dense vector, i.e. a dlib::matrix) then
- is_vector(x) == true
- x.size() == weights.nc()
(i.e. it must be legal to multiply weights with x)
ensures
- Returns the predicted label for the x sample and also it's score.
In particular, it returns the following:
std::make_pair(labels[index_of_max(weights*x-b)], max(weights*x-b))
!*/
result_type
operator
()
(
const
sample_type
&
x
)
const
;
...
...
@@ -942,6 +959,7 @@ namespace dlib
- Returns the predicted label for the x sample. In particular, it returns
the following:
labels[index_of_max(weights*x-b)]
Or in other words, this function returns predict(x).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