Commit 39e1afa1 authored by Davis King's avatar Davis King

Moved things around so they are easier to link to the in the docs.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403328
parent 5e462564
......@@ -13,6 +13,32 @@
namespace dlib
{
// ----------------------------------------------------------------------------------------
template <typename kernel_type, typename EXP>
const decision_function<kernel_type> convert_to_decision_function (
const projection_function<kernel_type>& project_funct,
const matrix_exp<EXP>& vect
)
{
// make sure requires clause is not broken
DLIB_ASSERT(project_funct.out_vector_size() > 0 && is_vector(vect) &&
project_funct.out_vector_size() == vect.size() && project_funct.weights.nc() == project_funct.basis_vectors.size(),
"\t const decision_function convert_to_decision_function()"
<< "\n\t Invalid inputs to this function."
<< "\n\t project_funct.out_vector_size(): " << project_funct.out_vector_size()
<< "\n\t project_funct.weights.nc(): " << project_funct.weights.nc()
<< "\n\t project_funct.basis_vectors.size(): " << project_funct.basis_vectors.size()
<< "\n\t is_vector(vect): " << is_vector(vect)
<< "\n\t vect.size(): " << vect.size()
);
return decision_function<kernel_type>(trans(project_funct.weights)*vect,
0,
project_funct.kernel_function,
project_funct.basis_vectors);
}
// ----------------------------------------------------------------------------------------
template <typename kern_type>
......@@ -259,32 +285,6 @@ namespace dlib
empirical_kernel_map<kernel_type>& b
) { a.swap(b); }
// ----------------------------------------------------------------------------------------
template <typename kernel_type, typename EXP>
const decision_function<kernel_type> convert_to_decision_function (
const projection_function<kernel_type>& project_funct,
const matrix_exp<EXP>& vect
)
{
// make sure requires clause is not broken
DLIB_ASSERT(project_funct.out_vector_size() > 0 && is_vector(vect) &&
project_funct.out_vector_size() == vect.size() && project_funct.weights.nc() == project_funct.basis_vectors.size(),
"\t const decision_function convert_to_decision_function()"
<< "\n\t Invalid inputs to this function."
<< "\n\t project_funct.out_vector_size(): " << project_funct.out_vector_size()
<< "\n\t project_funct.weights.nc(): " << project_funct.weights.nc()
<< "\n\t project_funct.basis_vectors.size(): " << project_funct.basis_vectors.size()
<< "\n\t is_vector(vect): " << is_vector(vect)
<< "\n\t vect.size(): " << vect.size()
);
return decision_function<kernel_type>(trans(project_funct.weights)*vect,
0,
project_funct.kernel_function,
project_funct.basis_vectors);
}
// ----------------------------------------------------------------------------------------
}
......
......@@ -12,6 +12,35 @@
namespace dlib
{
// ----------------------------------------------------------------------------------------
template <
typename kernel_type,
typename EXP
>
const decision_function<kernel_type> convert_to_decision_function (
const projection_function<kernel_type>& project_funct,
const matrix_exp<EXP>& vect
);
/*!
requires
- is_vector(vect) == true
- vect.size() == project_funct.out_vector_size()
- project_funct.out_vector_size() > 0
- project_funct.weights.nc() == project_funct.basis_vectors.size()
ensures
- This function interprets the given vector as a point in the kernel feature space defined
by the given projection function. The return value of this function is a decision
function, DF, that represents the given vector in the following sense:
- for all possible sample_type objects, S, it is the case that DF(S) == dot(project_funct(S), vect)
(i.e. the returned decision function computes dot products, in kernel feature space,
between vect and any argument you give it. Note also that this equality is exact, even
for sample_type objects not in the span of the basis_vectors.)
- DF.kernel_function == project_funct.kernel_function
- DF.b == 0
- DF.basis_vectors == project_funct.basis_vectors.
!*/
// ----------------------------------------------------------------------------------------
template <
......@@ -264,35 +293,6 @@ namespace dlib
provides serialization support for empirical_kernel_map objects
!*/
// ----------------------------------------------------------------------------------------
template <
typename kernel_type,
typename EXP
>
const decision_function<kernel_type> convert_to_decision_function (
const projection_function<kernel_type>& project_funct,
const matrix_exp<EXP>& vect
);
/*!
requires
- is_vector(vect) == true
- vect.size() == project_funct.out_vector_size()
- project_funct.out_vector_size() > 0
- project_funct.weights.nc() == project_funct.basis_vectors.size()
ensures
- This function interprets the given vector as a point in the kernel feature space defined
by the given projection function. The return value of this function is a decision
function, DF, that represents the given vector in the following sense:
- for all possible sample_type objects, S, it is the case that DF(S) == dot(project_funct(S), vect)
(i.e. the returned decision function computes dot products, in kernel feature space,
between vect and any argument you give it. Note also that this equality is exact, even
for sample_type objects not in the span of the basis_vectors.)
- DF.kernel_function == project_funct.kernel_function
- DF.b == 0
- DF.basis_vectors == project_funct.basis_vectors.
!*/
// ----------------------------------------------------------------------------------------
}
......
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