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
82564712
Commit
82564712
authored
May 17, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor change to avoid false alarms in unit test.
parent
0e10ca89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
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
double
obj
;
decision_function
<
sparse_linear_kernel
<
sparse_sample_type
>
>
df
=
trainer
.
train
(
samples
,
labels
,
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
[
1
])
-
(
-
1
))
<
1e-6
);
...
...
@@ -188,10 +188,10 @@ namespace
double
obj
;
decision_function
<
linear_kernel
<
sample_type
>
>
df
=
trainer
.
train
(
samples
,
labels
,
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
// 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
);
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