Skip to content
Snippets Groups Projects
Commit b97c952a authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Finalize porting of all bob.measure bindings

parent caa35bd8
No related branches found
No related tags found
No related merge requests found
...@@ -890,18 +890,51 @@ static PyObject* rocch2eer(PyObject*, PyObject* args, PyObject* kwds) { ...@@ -890,18 +890,51 @@ static PyObject* rocch2eer(PyObject*, PyObject* args, PyObject* kwds) {
} }
/** PyDoc_STRVAR(s_roc_for_far_str, "roc_for_far");
void bind_measure_error() { PyDoc_STRVAR(s_roc_for_far_doc,
"roc_for_far(negatives, positives, far_list) -> array\n\
\n\
Calculates the ROC curve given a set of positive and negative\n\
scores and the FAR values for which the CAR should be computed.\n\
The resulting ROC curve holds a copy of the given FAR values (row\n\
0), and the corresponding FRR values (row 1).\n\
");
static PyObject* roc_for_far(PyObject*, PyObject* args, PyObject* kwds) {
/* Parses input arguments in a single shot */
static const char* const_kwlist[] = {
"negatives",
"positives",
"far_list",
0 /* Sentinel */
};
static char** kwlist = const_cast<char**>(const_kwlist);
def( PyBlitzArrayObject* neg = 0;
"roc_for_far", PyBlitzArrayObject* pos = 0;
&bob_roc_for_far, PyBlitzArrayObject* list = 0;
(arg("negatives"), arg("positives"), arg("far_list")),
"Calculates the ROC curve given a set of positive and negative scores and the FAR values for which the CAR should be computed. The resulting ROC curve holds a copy of the given FAR values (row 0), and the corresponding FRR values (row 1)." if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&O&O&",
); kwlist,
&double1d_converter, &neg,
&double1d_converter, &pos,
&double1d_converter, &list
)) return 0;
auto result = bob::measure::roc_for_far(
*PyBlitzArrayCxx_AsBlitz<double,1>(neg),
*PyBlitzArrayCxx_AsBlitz<double,1>(pos),
*PyBlitzArrayCxx_AsBlitz<double,1>(list)
);
Py_DECREF(neg);
Py_DECREF(pos);
Py_DECREF(list);
return reinterpret_cast<PyObject*>(PyBlitzArrayCxx_NewFromArray(result));
} }
**/
static PyMethodDef library_methods[] = { static PyMethodDef library_methods[] = {
{ {
...@@ -1012,6 +1045,12 @@ static PyMethodDef library_methods[] = { ...@@ -1012,6 +1045,12 @@ static PyMethodDef library_methods[] = {
METH_VARARGS|METH_KEYWORDS, METH_VARARGS|METH_KEYWORDS,
s_rocch2eer_doc s_rocch2eer_doc
}, },
{
s_roc_for_far_str,
(PyCFunction)roc_for_far,
METH_VARARGS|METH_KEYWORDS,
s_roc_for_far_doc
},
{0} /* Sentinel */ {0} /* Sentinel */
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment