simplify_linear_decision_function_abstract.h 2.56 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (C) 2010  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#undef DLIB_SIMPLIFY_LINEAR_DECiSION_FUNCTION_ABSTRACT_H__
#ifdef DLIB_SIMPLIFY_LINEAR_DECiSION_FUNCTION_ABSTRACT_H__

#include "../algs.h"
#include "function_abstract.h"
#include "sparse_kernel_abstract.h"
#include "kernel_abstract.h"

namespace dlib
{

// ----------------------------------------------------------------------------------------

    template <
        typename T
        >
    decision_function<sparse_linear_kernel<T> > simplify_linear_decision_function (
        const decision_function<sparse_linear_kernel<T> >& df
    );
    /*!
        requires
            - T must be a sparse vector as defined in dlib/svm/sparse_vector_abstract.h
        ensures
            - returns a simplified version of df that only has one basis vector.  That
              is, returns a decision function D such that:
                - D.basis_vectors.size() == 1 (or 0 if df is empty)
                - for all possible x: D(x) == df(x)
    !*/

// ----------------------------------------------------------------------------------------

    template <
        typename T
        >
    decision_function<linear_kernel<T> > simplify_linear_decision_function (
        const decision_function<linear_kernel<T> >& df
    );
    /*!
        requires
            - T must be a dlib::matrix object 
        ensures
            - returns a simplified version of df that only has one basis vector.  That
              is, returns a decision function D such that:
                - D.basis_vectors.size() == 1 (or 0 if df is empty)
                - for all possible x: D(x) == df(x)
    !*/

// ----------------------------------------------------------------------------------------

    template <
        typename T
        >
    decision_function<linear_kernel<T> > simplify_linear_decision_function (
        const normalized_function<decision_function<linear_kernel<T> >, vector_normalizer<T> >& df
    );
    /*!
        requires
            - T must be a dlib::matrix object 
        ensures
            - returns a simplified version of df that only has one basis vector and 
              doesn't involve an explicit vector_normalizer.  That is, returns a 
              decision function D such that:
                - D.basis_vectors.size() == 1 (or 0 if df is empty)
                - for all possible x: D(x) == df(x)
    !*/

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_SIMPLIFY_LINEAR_DECiSION_FUNCTION_ABSTRACT_H__