MCPcopy Create free account
hub / github.com/davisking/dlib / normalized_predict_np

Function normalized_predict_np

tools/python/src/decision_functions.cpp:160–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158
159template <typename decision_function>
160double 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
181template <typename kernel_type>
182void add_df (

Callers

nothing calls this directly

Calls 3

np_to_matFunction · 0.85
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected