Changed the cross_validate_trainer() function so that it catches

invalid_svm_nu_error exceptions and just gives them a bad score rather
than letting them get out and annoy the user.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402900
This commit is contained in:
Davis King 2009-03-06 21:55:39 +00:00
parent f61ef323e0
commit aa76eec386
1 changed files with 11 additions and 2 deletions

View File

@ -464,8 +464,17 @@ namespace dlib
train_neg_idx = (train_neg_idx+1)%x.nr();
}
// do the training and testing
res += test_binary_decision_function(trainer.train(x_train,y_train),x_test,y_test);
try
{
// do the training and testing
res += test_binary_decision_function(trainer.train(x_train,y_train),x_test,y_test);
}
catch (invalid_svm_nu_error&)
{
// Just ignore the error in this case since we are going to
// interpret an invalid nu value the same as generating a decision
// function that miss-classifies everything.
}
} // for (long i = 0; i < folds; ++i)