| 25 | typename K |
| 26 | > |
| 27 | struct decision_function |
| 28 | { |
| 29 | typedef K kernel_type; |
| 30 | typedef typename K::scalar_type scalar_type; |
| 31 | typedef typename K::scalar_type result_type; |
| 32 | typedef typename K::sample_type sample_type; |
| 33 | typedef typename K::mem_manager_type mem_manager_type; |
| 34 | |
| 35 | typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type; |
| 36 | typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type; |
| 37 | |
| 38 | scalar_vector_type alpha; |
| 39 | scalar_type b; |
| 40 | K kernel_function; |
| 41 | sample_vector_type basis_vectors; |
| 42 | |
| 43 | decision_function ( |
| 44 | ) : b(0), kernel_function(K()) {} |
| 45 | |
| 46 | decision_function ( |
| 47 | const scalar_vector_type& alpha_, |
| 48 | const scalar_type& b_, |
| 49 | const K& kernel_function_, |
| 50 | const sample_vector_type& basis_vectors_ |
| 51 | ) : |
| 52 | alpha(alpha_), |
| 53 | b(b_), |
| 54 | kernel_function(kernel_function_), |
| 55 | basis_vectors(basis_vectors_) |
| 56 | {} |
| 57 | |
| 58 | result_type operator() ( |
| 59 | const sample_type& x |
| 60 | ) const |
| 61 | { |
| 62 | result_type temp = 0; |
| 63 | for (long i = 0; i < alpha.nr(); ++i) |
| 64 | temp += alpha(i) * kernel_function(x,basis_vectors(i)); |
| 65 | |
| 66 | return temp - b; |
| 67 | } |
| 68 | }; |
| 69 | |
| 70 | template < |
| 71 | typename K |
no outgoing calls