Added a try catch block to catch invalid_svm_nu_error exceptions.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402893
This commit is contained in:
Davis King 2009-03-06 04:16:45 +00:00
parent 70b7137c1f
commit e3c0792968
1 changed files with 10 additions and 1 deletions

View File

@ -89,7 +89,16 @@ namespace dlib
matrix<scalar_type, 1, 2, mem_manager_type> temp_res;
while (job_pipe.dequeue(j))
{
temp_res = test_binary_decision_function(j.trainer.train(j.x_train, j.y_train), j.x_test, j.y_test);
try
{
temp_res = test_binary_decision_function(j.trainer.train(j.x_train, j.y_train), j.x_test, j.y_test);
}
catch (invalid_svm_nu_error&)
{
// If this is a svm_nu_trainer then we might get this exception if the nu is
// invalid. In this case just return a cross validation score of 0.
temp_res = 0;
}
res_pipe.enqueue(temp_res);
}