Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.measure
Commits
b97c952a
Commit
b97c952a
authored
Dec 11, 2013
by
André Anjos
💬
Browse files
Finalize porting of all bob.measure bindings
parent
caa35bd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
xbob/measure/main.cpp
View file @
b97c952a
...
...
@@ -890,18 +890,51 @@ static PyObject* rocch2eer(PyObject*, PyObject* args, PyObject* kwds) {
}
/**
void bind_measure_error() {
PyDoc_STRVAR
(
s_roc_for_far_str
,
"roc_for_far"
);
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(
"roc_for_far",
&bob_roc_for_far,
(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)."
);
PyBlitzArrayObject
*
neg
=
0
;
PyBlitzArrayObject
*
pos
=
0
;
PyBlitzArrayObject
*
list
=
0
;
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
[]
=
{
{
...
...
@@ -1012,6 +1045,12 @@ static PyMethodDef library_methods[] = {
METH_VARARGS
|
METH_KEYWORDS
,
s_rocch2eer_doc
},
{
s_roc_for_far_str
,
(
PyCFunction
)
roc_for_far
,
METH_VARARGS
|
METH_KEYWORDS
,
s_roc_for_far_doc
},
{
0
}
/* Sentinel */
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment