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
cb0bbee6
Commit
cb0bbee6
authored
Oct 04, 2013
by
Davis King
Browse files
Added missing assert
parent
8fd4b970
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
dlib/svm/function.h
dlib/svm/function.h
+22
-0
No files found.
dlib/svm/function.h
View file @
cb0bbee6
...
...
@@ -782,6 +782,17 @@ namespace dlib
const
sample_type
&
x
)
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)
// we do the following somewhat more complex thing because this supports
// both sparse and dense samples.
...
...
@@ -805,6 +816,17 @@ namespace dlib
const
sample_type
&
x
)
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
;
}
};
...
...
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