Commit f2a11f0e authored by Davis King's avatar Davis King

Relaxed some unnecessarily restrictive requires clauses.

parent da40c3ba
......@@ -558,15 +558,25 @@ namespace dlib
) const
{
// make sure requires clause is not broken
DLIB_ASSERT(is_binary_classification_problem(x,y) == true,
DLIB_ASSERT(is_learning_problem(x,y) == true,
"\t decision_function svm_c_linear_trainer::train(x,y)"
<< "\n\t invalid inputs were given to this function"
<< "\n\t x.nr(): " << x.nr()
<< "\n\t y.nr(): " << y.nr()
<< "\n\t x.nc(): " << x.nc()
<< "\n\t y.nc(): " << y.nc()
<< "\n\t is_binary_classification_problem(x,y): " << is_binary_classification_problem(x,y)
<< "\n\t is_learning_problem(x,y): " << is_learning_problem(x,y)
);
#ifdef ENABLE_ASSERTS
for (long i = 0; i < x.size(); ++i)
{
DLIB_ASSERT(y(i) == +1 || y(i) == -1,
"\t decision_function svm_c_linear_trainer::train(x,y)"
<< "\n\t invalid inputs were given to this function"
<< "\n\t y("<<i<<"): " << y(i)
);
}
#endif
typedef matrix<scalar_type,0,1> w_type;
......
......@@ -256,7 +256,9 @@ namespace dlib
) const;
/*!
requires
- is_binary_classification_problem(x,y) == true
- is_learning_problem(x,y) == true
(Note that it is ok for x.size() == 1)
- All elements of y must be equal to +1 or -1
- x == a matrix or something convertible to a matrix via mat().
Also, x should contain sample_type objects.
- y == a matrix or something convertible to a matrix via mat().
......@@ -285,7 +287,9 @@ namespace dlib
) const;
/*!
requires
- is_binary_classification_problem(x,y) == true
- is_learning_problem(x,y) == true
(Note that it is ok for x.size() == 1)
- All elements of y must be equal to +1 or -1
- x == a matrix or something convertible to a matrix via mat().
Also, x should contain sample_type objects.
- y == a matrix or something convertible to a matrix via mat().
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment