bigframes.ml.metrics.auc#

bigframes.ml.metrics.auc(x: DataFrame | Series, y: DataFrame | Series) float[source]#

Compute Area Under the Curve (AUC) using the trapezoidal rule.

This is a general function, given points on a curve. For computing the area under the ROC-curve, see roc_auc_score(). For an alternative way to summarize a precision-recall curve, see average_precision_score().

Examples:

>>> import bigframes.pandas as bpd
>>> import bigframes.ml.metrics
>>> x = bpd.DataFrame([1, 1, 2, 2])
>>> y = bpd.DataFrame([2, 3, 4, 5])
>>> auc = bigframes.ml.metrics.auc(x, y)
>>> auc
np.float64(3.5)

The input can be Series:

>>> df = bpd.DataFrame(
...     {"x": [1, 1, 2, 2],
...      "y": [2, 3, 4, 5],}
... )
>>> auc = bigframes.ml.metrics.auc(df["x"], df["y"])
>>> auc
np.float64(3.5)
Parameters:
  • x (Series or DataFrame of shape (n_samples,)) – X coordinates. These must be either monotonic increasing or monotonic decreasing.

  • y (Series or DataFrame of shape (n_samples,)) – Y coordinates.

Returns:

Area Under the Curve.

Return type:

float