mirror of https://github.com/davisking/dlib.git
Added code to test the oca interface with a prior vector.
This commit is contained in:
parent
f25ca01e07
commit
c67975c7d6
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue