Commit 07c43999 authored by Davis King's avatar Davis King

Added get_kernel() member functions to the reduced set trainers.

Also added missing comments to the spec.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402424
parent 8e8b04d9
......@@ -46,6 +46,12 @@ namespace dlib
);
}
const kernel_type& get_kernel (
) const
{
return trainer.get_kernel();
}
template <
typename in_sample_vector_type,
typename in_scalar_vector_type
......@@ -187,7 +193,7 @@ namespace dlib
COMPILE_TIME_ASSERT(is_matrix<sample_type>::value);
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0,
DLIB_ASSERT(num_sv > 0 && eps > 0,
"\t reduced_decision_function_trainer2()"
<< "\n\t you have given invalid arguments to this function"
<< "\n\t num_sv: " << num_sv
......@@ -195,6 +201,12 @@ namespace dlib
);
}
const kernel_type& get_kernel (
) const
{
return trainer.get_kernel();
}
template <
typename in_sample_vector_type,
typename in_scalar_vector_type
......@@ -576,7 +588,7 @@ namespace dlib
COMPILE_TIME_ASSERT(is_matrix<typename trainer_type::sample_type>::value);
// make sure requires clause is not broken
DLIB_ASSERT(num_sv > 0,
DLIB_ASSERT(num_sv > 0 && eps > 0,
"\tconst reduced_decision_function_trainer2 reduced2()"
<< "\n\t you have given invalid arguments to this function"
<< "\n\t num_sv: " << num_sv
......
......@@ -54,6 +54,14 @@ namespace dlib
decision_function objects with fewer support vectors.
- The reduced decision functions that are output will have at most
num_sv support vectors.
- #get_kernel() == trainer.get_kernel()
!*/
const kernel_type& get_kernel (
) const;
/*!
ensures
- returns the kernel used by this trainer object
!*/
template <
......@@ -140,12 +148,24 @@ namespace dlib
/*!
requires
- num_sv > 0
- eps > 0
ensures
- returns a trainer object that applies post processing to the decision_function
objects created by the given trainer object with the goal of creating
decision_function objects with fewer support vectors.
- The reduced decision functions that are output will have at most
num_sv support vectors.
- the gradient based optimization will continue until the change in the
objective function is less than eps. So smaller values of eps will
give better results but take longer to compute.
- #get_kernel() == trainer.get_kernel()
!*/
const kernel_type& get_kernel (
) const;
/*!
ensures
- returns the kernel used by this trainer object
!*/
template <
......@@ -184,6 +204,7 @@ namespace dlib
- trainer_type == some kind of trainer object that creates decision_function
objects (e.g. svm_nu_trainer)
- kernel_derivative<trainer_type::kernel_type> is defined
- eps > 0
ensures
- returns a reduced_decision_function_trainer2 object that has been
instantiated with the given arguments.
......
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