| 158 | |
| 159 | template <typename decision_function> |
| 160 | double normalized_predict_np ( |
| 161 | const normalized_function<decision_function>& df, |
| 162 | const py::array_t<double>& samp |
| 163 | ) |
| 164 | { |
| 165 | typedef typename decision_function::kernel_type::sample_type T; |
| 166 | if (df.function.basis_vectors.size() == 0) |
| 167 | { |
| 168 | return 0; |
| 169 | } |
| 170 | else if (is_matrix<T>::value && df.function.basis_vectors(0).size() != samp.size()) |
| 171 | { |
| 172 | std::ostringstream sout; |
| 173 | sout << "Input vector should have " << df.function.basis_vectors(0).size() |
| 174 | << " dimensions, not " << samp.size() << "."; |
| 175 | PyErr_SetString( PyExc_ValueError, sout.str().c_str() ); |
| 176 | throw py::error_already_set(); |
| 177 | } |
| 178 | return df(np_to_mat(samp)); |
| 179 | } |
| 180 | |
| 181 | template <typename kernel_type> |
| 182 | void add_df ( |