From 8515da8ccf5b65c3d968e8ca86c253d0c7dace0c Mon Sep 17 00:00:00 2001 From: Davis King Date: Wed, 22 Dec 2010 18:45:52 +0000 Subject: [PATCH] Added some tests for the svm_c_trainer --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%404005 --- dlib/test/svm.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlib/test/svm.cpp b/dlib/test/svm.cpp index a40caed3b..03df102e0 100644 --- a/dlib/test/svm.cpp +++ b/dlib/test/svm.cpp @@ -368,6 +368,10 @@ namespace trainer.set_kernel(kernel_type(gamma)); trainer.set_nu(0.05); + svm_c_trainer c_trainer; + c_trainer.set_kernel(kernel_type(gamma)); + c_trainer.set_c(100); + svm_c_linear_trainer > > lin_trainer; lin_trainer.set_c(100000); // use an ekm to linearize this dataset so we can use it with the lin_trainer @@ -384,6 +388,8 @@ namespace print_spinner(); matrix svm_cv = cross_validate_trainer(trainer, x,y, 4); print_spinner(); + matrix svm_c_cv = cross_validate_trainer(c_trainer, x,y, 4); + print_spinner(); matrix rbf_cv = cross_validate_trainer_threaded(rbf_trainer, x,y, 10, 2); print_spinner(); matrix lin_cv = cross_validate_trainer_threaded(lin_trainer, x_linearized, y, 4, 2); @@ -400,7 +406,8 @@ namespace dlog << LDEBUG << "rvm cv: " << rvm_cv; dlog << LDEBUG << "krr cv: " << krr_cv; - dlog << LDEBUG << "svm cv: " << svm_cv; + dlog << LDEBUG << "nu-svm cv: " << svm_cv; + dlog << LDEBUG << "C-svm cv: " << svm_c_cv; dlog << LDEBUG << "rbf cv: " << rbf_cv; dlog << LDEBUG << "lin cv: " << lin_cv; dlog << LDEBUG << "ocas_ekm cv: " << ocas_ekm_cv; @@ -415,6 +422,7 @@ namespace DLIB_TEST_MSG(mean(rvm_cv) > 0.9, rvm_cv); DLIB_TEST_MSG(mean(krr_cv) > 0.9, krr_cv); DLIB_TEST_MSG(mean(svm_cv) > 0.9, svm_cv); + DLIB_TEST_MSG(mean(svm_c_cv) > 0.9, svm_c_cv); DLIB_TEST_MSG(mean(rbf_cv) > 0.9, rbf_cv); DLIB_TEST_MSG(mean(lin_cv) > 0.9, lin_cv); DLIB_TEST_MSG(mean(peg_cv) > 0.9, peg_cv);