| 60 | |
| 61 | template <typename decision_function> |
| 62 | double predict ( |
| 63 | const decision_function& df, |
| 64 | const typename decision_function::kernel_type::sample_type& samp |
| 65 | ) |
| 66 | { |
| 67 | typedef typename decision_function::kernel_type::sample_type T; |
| 68 | if (df.basis_vectors.size() == 0) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
| 72 | else if (is_matrix<T>::value && df.basis_vectors(0).size() != samp.size()) |
| 73 | { |
| 74 | std::ostringstream sout; |
| 75 | sout << "Input vector should have " << df.basis_vectors(0).size() |
| 76 | << " dimensions, not " << samp.size() << "."; |
| 77 | PyErr_SetString( PyExc_ValueError, sout.str().c_str() ); |
| 78 | throw py::error_already_set(); |
| 79 | } |
| 80 | return df(samp); |
| 81 | } |
| 82 | |
| 83 | inline matrix<double,0,1> np_to_mat( |
| 84 | const py::array_t<double>& samp |
no test coverage detected