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
82564712
Commit
82564712
authored
May 17, 2013
by
Davis King
Browse files
Minor change to avoid false alarms in unit test.
parent
0e10ca89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
dlib/test/svm_c_linear.cpp
dlib/test/svm_c_linear.cpp
+3
-3
No files found.
dlib/test/svm_c_linear.cpp
View file @
82564712
...
@@ -116,7 +116,7 @@ namespace
...
@@ -116,7 +116,7 @@ namespace
double
obj
;
double
obj
;
decision_function
<
sparse_linear_kernel
<
sparse_sample_type
>
>
df
=
trainer
.
train
(
samples
,
labels
,
obj
);
decision_function
<
sparse_linear_kernel
<
sparse_sample_type
>
>
df
=
trainer
.
train
(
samples
,
labels
,
obj
);
dlog
<<
LDEBUG
<<
"obj: "
<<
obj
;
dlog
<<
LDEBUG
<<
"obj: "
<<
obj
;
DLIB_TEST_MSG
(
abs
(
obj
-
0.72222222222
)
<
1e-
8
,
obj
);
DLIB_TEST_MSG
(
abs
(
obj
-
0.72222222222
)
<
1e-
7
,
obj
);
DLIB_TEST
(
abs
(
df
(
samples
[
0
])
-
(
-
1
))
<
1e-6
);
DLIB_TEST
(
abs
(
df
(
samples
[
0
])
-
(
-
1
))
<
1e-6
);
DLIB_TEST
(
abs
(
df
(
samples
[
1
])
-
(
-
1
))
<
1e-6
);
DLIB_TEST
(
abs
(
df
(
samples
[
1
])
-
(
-
1
))
<
1e-6
);
...
@@ -188,10 +188,10 @@ namespace
...
@@ -188,10 +188,10 @@ namespace
double
obj
;
double
obj
;
decision_function
<
linear_kernel
<
sample_type
>
>
df
=
trainer
.
train
(
samples
,
labels
,
obj
);
decision_function
<
linear_kernel
<
sample_type
>
>
df
=
trainer
.
train
(
samples
,
labels
,
obj
);
dlog
<<
LDEBUG
<<
"obj: "
<<
obj
;
dlog
<<
LDEBUG
<<
"obj: "
<<
obj
;
DLIB_TEST_MSG
(
abs
(
obj
-
0.72222222222
)
<
1e-
8
,
abs
(
obj
-
0.72222222222
));
DLIB_TEST_MSG
(
abs
(
obj
-
0.72222222222
)
<
1e-
7
,
abs
(
obj
-
0.72222222222
));
// There shouldn't be any margin violations since this dataset is so trivial. So that means the objective
// There shouldn't be any margin violations since this dataset is so trivial. So that means the objective
// should be exactly the squared norm of the decision plane (times 0.5).
// should be exactly the squared norm of the decision plane (times 0.5).
DLIB_TEST_MSG
(
abs
(
length_squared
(
df
.
basis_vectors
(
0
))
*
0.5
+
df
.
b
*
df
.
b
*
0.5
-
0.72222222222
)
<
1e-
8
,
DLIB_TEST_MSG
(
abs
(
length_squared
(
df
.
basis_vectors
(
0
))
*
0.5
+
df
.
b
*
df
.
b
*
0.5
-
0.72222222222
)
<
1e-
7
,
length_squared
(
df
.
basis_vectors
(
0
))
*
0.5
+
df
.
b
*
df
.
b
*
0.5
);
length_squared
(
df
.
basis_vectors
(
0
))
*
0.5
+
df
.
b
*
df
.
b
*
0.5
);
DLIB_TEST
(
abs
(
df
(
samples
[
0
])
-
(
-
1
))
<
1e-6
);
DLIB_TEST
(
abs
(
df
(
samples
[
0
])
-
(
-
1
))
<
1e-6
);
...
...
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