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
cb0bbee6
Commit
cb0bbee6
authored
Oct 05, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing assert
parent
8fd4b970
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
function.h
dlib/svm/function.h
+22
-0
No files found.
dlib/svm/function.h
View file @
cb0bbee6
...
@@ -782,6 +782,17 @@ namespace dlib
...
@@ -782,6 +782,17 @@ namespace dlib
const
sample_type
&
x
const
sample_type
&
x
)
const
)
const
{
{
// make sure requires clause is not broken
DLIB_ASSERT
(
weights
.
size
()
>
0
&&
weights
.
nr
()
==
(
long
)
number_of_classes
()
&&
weights
.
nr
()
==
b
.
size
(),
"
\t
pair<result_type,scalar_type> multiclass_linear_decision_function::predict(x)"
<<
"
\n\t
This object must be properly initialized before you can use it."
<<
"
\n\t
weights.size(): "
<<
weights
.
size
()
<<
"
\n\t
weights.nr(): "
<<
weights
.
nr
()
<<
"
\n\t
number_of_classes(): "
<<
number_of_classes
()
);
// Rather than doing something like, best_idx = index_of_max(weights*x-b)
// Rather than doing something like, best_idx = index_of_max(weights*x-b)
// we do the following somewhat more complex thing because this supports
// we do the following somewhat more complex thing because this supports
// both sparse and dense samples.
// both sparse and dense samples.
...
@@ -805,6 +816,17 @@ namespace dlib
...
@@ -805,6 +816,17 @@ namespace dlib
const
sample_type
&
x
const
sample_type
&
x
)
const
)
const
{
{
// make sure requires clause is not broken
DLIB_ASSERT
(
weights
.
size
()
>
0
&&
weights
.
nr
()
==
(
long
)
number_of_classes
()
&&
weights
.
nr
()
==
b
.
size
(),
"
\t
result_type multiclass_linear_decision_function::operator()(x)"
<<
"
\n\t
This object must be properly initialized before you can use it."
<<
"
\n\t
weights.size(): "
<<
weights
.
size
()
<<
"
\n\t
weights.nr(): "
<<
weights
.
nr
()
<<
"
\n\t
number_of_classes(): "
<<
number_of_classes
()
);
return
predict
(
x
).
first
;
return
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