Commit fdcceedb authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

FAR,FRR,CAR->FPR,FNR,CPR and set the laters as main names

parent af742e63
Pipeline #21937 passed with stage
in 10 minutes and 24 seconds
...@@ -39,13 +39,13 @@ bob::measure::farfrr(const blitz::Array<double, 1> &negatives, ...@@ -39,13 +39,13 @@ bob::measure::farfrr(const blitz::Array<double, 1> &negatives,
const blitz::Array<double, 1> &positives, const blitz::Array<double, 1> &positives,
double threshold) { double threshold) {
if (std::isnan(threshold)){ if (std::isnan(threshold)){
bob::core::error << "Cannot compute FAR (FPR) or FRR (FNR) with threshold NaN.\n"; bob::core::error << "Cannot compute FPR (FAR) or FNR (FRR) with threshold NaN.\n";
return std::make_pair(1.,1.); return std::make_pair(1.,1.);
} }
if (!negatives.size()) if (!negatives.size())
throw std::runtime_error("Cannot compute FAR (FPR) when no negatives are given"); throw std::runtime_error("Cannot compute FPR (FAR) when no negatives are given");
if (!positives.size()) if (!positives.size())
throw std::runtime_error("Cannot compute FRR (FNR) when no positives are given"); throw std::runtime_error("Cannot compute FNR (FRR) when no positives are given");
blitz::sizeType total_negatives = negatives.extent(blitz::firstDim); blitz::sizeType total_negatives = negatives.extent(blitz::firstDim);
blitz::sizeType total_positives = positives.extent(blitz::firstDim); blitz::sizeType total_positives = positives.extent(blitz::firstDim);
blitz::sizeType false_accepts = blitz::count(negatives >= threshold); blitz::sizeType false_accepts = blitz::count(negatives >= threshold);
......
...@@ -350,7 +350,7 @@ double rocch2eer(const blitz::Array<double, 2> &pmiss_pfa); ...@@ -350,7 +350,7 @@ double rocch2eer(const blitz::Array<double, 2> &pmiss_pfa);
/** /**
* Calculates the ROC curve given a set of positive and negative scores at * Calculates the ROC curve given a set of positive and negative scores at
* the given FPR coordinates. Returns a two-dimensional blitz::Array of * the given FPR coordinates. Returns a two-dimensional blitz::Array of
* doubles that express the X (FPR) and Y (CAR) coordinates in this order. * doubles that express the X (FPR) and Y (CPR) coordinates in this order.
*/ */
blitz::Array<double, 2> roc_for_far(const blitz::Array<double, 1> &negatives, blitz::Array<double, 2> roc_for_far(const blitz::Array<double, 1> &negatives,
const blitz::Array<double, 1> &positives, const blitz::Array<double, 1> &positives,
......
...@@ -80,8 +80,8 @@ def roc(negatives, positives, npoints=100, CAR=False, **kwargs): ...@@ -80,8 +80,8 @@ def roc(negatives, positives, npoints=100, CAR=False, **kwargs):
npoints (:py:class:`int`, optional): The number of points for the plot. See npoints (:py:class:`int`, optional): The number of points for the plot. See
(:py:func:`bob.measure.roc`) (:py:func:`bob.measure.roc`)
CAR (:py:class:`bool`, optional): If set to ``True``, it will plot the CAR CAR (:py:class:`bool`, optional): If set to ``True``, it will plot the CPR
over FPR in using :py:func:`matplotlib.pyplot.semilogx`, otherwise the (CAR) over FPR in using :py:func:`matplotlib.pyplot.semilogx`, otherwise the
FPR over FNR linearly using :py:func:`matplotlib.pyplot.plot`. FPR over FNR linearly using :py:func:`matplotlib.pyplot.plot`.
kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
...@@ -107,7 +107,7 @@ def roc(negatives, positives, npoints=100, CAR=False, **kwargs): ...@@ -107,7 +107,7 @@ def roc(negatives, positives, npoints=100, CAR=False, **kwargs):
def roc_for_far(negatives, positives, far_values=log_values(), CAR=True, def roc_for_far(negatives, positives, far_values=log_values(), CAR=True,
**kwargs): **kwargs):
"""Plots the ROC curve for the given list of False Acceptance Rates (FPR). """Plots the ROC curve for the given list of False Positive Rates (FAR).
This method will call ``matplotlib`` to plot the ROC curve for a system which This method will call ``matplotlib`` to plot the ROC curve for a system which
contains a particular set of negatives (impostors) and positives (clients) contains a particular set of negatives (impostors) and positives (clients)
...@@ -115,8 +115,8 @@ def roc_for_far(negatives, positives, far_values=log_values(), CAR=True, ...@@ -115,8 +115,8 @@ def roc_for_far(negatives, positives, far_values=log_values(), CAR=True,
All parameters passed with exception of the three first parameters of this All parameters passed with exception of the three first parameters of this
method will be directly passed to the plot command. method will be directly passed to the plot command.
The plot will represent the False Acceptance Rate (FPR) on the horizontal The plot will represent the False Positive Rate (FPR) on the horizontal
axis and the Correct Acceptance Rate (CAR) on the vertical axis. The values axis and the Correct Positive Rate (CPR) on the vertical axis. The values
for the axis will be computed using :py:func:`bob.measure.roc_for_far`. for the axis will be computed using :py:func:`bob.measure.roc_for_far`.
.. note:: .. note::
...@@ -137,10 +137,10 @@ def roc_for_far(negatives, positives, far_values=log_values(), CAR=True, ...@@ -137,10 +137,10 @@ def roc_for_far(negatives, positives, far_values=log_values(), CAR=True,
(:py:func:`bob.measure.roc`) (:py:func:`bob.measure.roc`)
far_values (:py:class:`list`, optional): The values for the FPR, where the far_values (:py:class:`list`, optional): The values for the FPR, where the
CAR should be plotted; each value should be in range [0,1]. CPR (CAR) should be plotted; each value should be in range [0,1].
CAR (:py:class:`bool`, optional): If set to ``True``, it will plot the CAR CAR (:py:class:`bool`, optional): If set to ``True``, it will plot the CPR
over FPR in using :py:func:`matplotlib.pyplot.semilogx`, otherwise the (CAR) over FPR in using :py:func:`matplotlib.pyplot.semilogx`, otherwise the
FPR over FNR linearly using :py:func:`matplotlib.pyplot.plot`. FPR over FNR linearly using :py:func:`matplotlib.pyplot.plot`.
kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are kwargs (:py:class:`dict`, optional): Extra plotting parameters, which are
...@@ -534,8 +534,8 @@ def detection_identification_curve(cmc_scores, far_values=log_values(), rank=1, ...@@ -534,8 +534,8 @@ def detection_identification_curve(cmc_scores, far_values=log_values(), rank=1,
rank (:py:class:`int`, optional): The rank for which the curve should be rank (:py:class:`int`, optional): The rank for which the curve should be
plotted plotted
far_values (:py:class:`list`, optional): The values for the FAR (FPR), where the far_values (:py:class:`list`, optional): The values for the FPR (FAR), where the
CAR should be plotted; each value should be in range [0,1]. CPR (CAR) should be plotted; each value should be in range [0,1].
logx (:py:class:`bool`, optional): If set (the default), plots the rank logx (:py:class:`bool`, optional): If set (the default), plots the rank
axis in logarithmic scale using :py:func:`matplotlib.pyplot.semilogx` or axis in logarithmic scale using :py:func:`matplotlib.pyplot.semilogx` or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment