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
c67975c7
"apps/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "7451bb2a014fdcba6046691f71e392a8538c6183"
Commit
c67975c7
authored
Feb 09, 2014
by
Davis King
Browse files
Added code to test the oca interface with a prior vector.
parent
f25ca01e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
dlib/test/oca.cpp
dlib/test/oca.cpp
+35
-0
No files found.
dlib/test/oca.cpp
View file @
c67975c7
...
...
@@ -72,6 +72,41 @@ namespace
dlog
<<
LINFO
<<
"error: "
<<
max
(
abs
(
w
-
true_w
));
DLIB_TEST
(
max
(
abs
(
w
-
true_w
))
<
1e-10
);
w_type
prior
=
true_w
;
solver
(
make_oca_problem_c_svm
<
w_type
>
(
20.0
,
30.0
,
mat
(
x
),
mat
(
y
),
false
,
1e-12
,
40
),
w
,
prior
);
dlog
<<
LINFO
<<
trans
(
w
);
true_w
=
-
0.5
,
0.5
,
0
;
dlog
<<
LINFO
<<
"error: "
<<
max
(
abs
(
w
-
true_w
));
DLIB_TEST
(
max
(
abs
(
w
-
true_w
))
<
1e-10
);
prior
=
0
,
0
,
0
;
solver
(
make_oca_problem_c_svm
<
w_type
>
(
20.0
,
30.0
,
mat
(
x
),
mat
(
y
),
false
,
1e-12
,
40
),
w
,
prior
);
dlog
<<
LINFO
<<
trans
(
w
);
true_w
=
-
0.5
,
0.5
,
0
;
dlog
<<
LINFO
<<
"error: "
<<
max
(
abs
(
w
-
true_w
));
DLIB_TEST
(
max
(
abs
(
w
-
true_w
))
<
1e-10
);
prior
=
-
1
,
1
,
0
;
solver
(
make_oca_problem_c_svm
<
w_type
>
(
20.0
,
30.0
,
mat
(
x
),
mat
(
y
),
false
,
1e-12
,
40
),
w
,
prior
);
dlog
<<
LINFO
<<
trans
(
w
);
true_w
=
-
1.0
,
1.0
,
0
;
dlog
<<
LINFO
<<
"error: "
<<
max
(
abs
(
w
-
true_w
));
DLIB_TEST
(
max
(
abs
(
w
-
true_w
))
<
1e-10
);
prior
=
-
0.2
,
0.2
,
0
;
solver
(
make_oca_problem_c_svm
<
w_type
>
(
20.0
,
30.0
,
mat
(
x
),
mat
(
y
),
false
,
1e-12
,
40
),
w
,
prior
);
dlog
<<
LINFO
<<
trans
(
w
);
true_w
=
-
0.5
,
0.5
,
0
;
dlog
<<
LINFO
<<
"error: "
<<
max
(
abs
(
w
-
true_w
));
DLIB_TEST
(
max
(
abs
(
w
-
true_w
))
<
1e-10
);
prior
=
-
10.2
,
-
1
,
0
;
solver
(
make_oca_problem_c_svm
<
w_type
>
(
20.0
,
30.0
,
mat
(
x
),
mat
(
y
),
false
,
1e-12
,
40
),
w
,
prior
);
dlog
<<
LINFO
<<
trans
(
w
);
true_w
=
-
10.2
,
-
1.0
,
0
;
dlog
<<
LINFO
<<
"error: "
<<
max
(
abs
(
w
-
true_w
));
DLIB_TEST
(
max
(
abs
(
w
-
true_w
))
<
1e-10
);
print_spinner
();
// test the version with a non-negativity constraint on w.
...
...
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