# precision_recall_curve

### cuml.metrics.precision_recall_curve(y_true, probs_pred)[[source]](https://github.com/NVIDIA/cuml/blob/93418baf5/python/cuml/cuml/metrics/_ranking.py#L15)

Compute precision-recall pairs for different probability thresholds

#### NOTE
this implementation is restricted to the binary classification
task. The precision is the ratio `tp / (tp + fp)` where `tp` is the
number of true positives and `fp` the number of false positives. The
precision is intuitively the ability of the classifier not to label as
positive a sample that is negative.

The recall is the ratio `tp / (tp + fn)` where `tp` is the number
of true positives and `fn` the number of false negatives. The recall
is intuitively the ability of the classifier to find all the positive
samples. The last precision and recall values are 1. and 0.
respectively and do not have a corresponding threshold. This ensures
that the graph starts on the y axis.

Read more in the scikit-learn’s [User Guide](https://scikit-learn.org/stable/modules/model_evaluation.html#precision-recall-f-measure-metrics).

* **Parameters:**
  **y_true**
  : True binary labels, {0, 1}.

  **probas_pred**
  : Estimated probabilities or decision function.
* **Returns:**
  **precision**
  : Precision values such that element i is the precision of
    predictions with score >= thresholds[i] and the last element is 1.

  **recall**
  : Decreasing recall values such that element i is the recall of
    predictions with score >= thresholds[i] and the last element is 0.

  **thresholds**
  : Increasing thresholds on the decision function used to compute
    precision and recall.

### Examples

```python
>>> import cupy as cp
>>> from cuml.metrics import precision_recall_curve
>>> y_true = cp.array([0, 0, 1, 1])
>>> y_scores = cp.array([0.1, 0.4, 0.35, 0.8])
>>> precision, recall, thresholds = precision_recall_curve(
...     y_true, y_scores)
>>> print(precision)
[0.666... 0.5  1.  1. ]
>>> print(recall)
[1. 0.5 0.5 0. ]
>>> print(thresholds)
[0.35 0.4 0.8 ]
```

<!-- !! processed by numpydoc !! -->
