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

Function normalized_predict

tools/python/src/decision_functions.cpp:96–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95template <typename decision_function>
96double normalized_predict (
97 const normalized_function<decision_function>& df,
98 const typename decision_function::kernel_type::sample_type& samp
99)
100{
101 typedef typename decision_function::kernel_type::sample_type T;
102 if (df.function.basis_vectors.size() == 0)
103 {
104 return 0;
105 }
106 else if (is_matrix<T>::value && df.function.basis_vectors(0).size() != samp.size())
107 {
108 std::ostringstream sout;
109 sout << "Input vector should have " << df.function.basis_vectors(0).size()
110 << " dimensions, not " << samp.size() << ".";
111 PyErr_SetString( PyExc_ValueError, sout.str().c_str() );
112 throw py::error_already_set();
113 }
114 return df(samp);
115}
116
117template <typename decision_function>
118std::vector<double> normalized_predict_vec (

Callers 1

normalized_predict_vecFunction · 0.85

Calls 2

sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected