8.17.1.3. sklearn.metrics.auc¶
- sklearn.metrics.auc(x, y)¶
- Compute Area Under the Curve (AUC) using the trapezoidal rule - Parameters : - x : array, shape = [n] - x coordinates - y : array, shape = [n] - y coordinates - Returns : - auc : float - Examples - >>> import numpy as np >>> from sklearn import metrics >>> y = np.array([1, 1, 2, 2]) >>> pred = np.array([0.1, 0.4, 0.35, 0.8]) >>> fpr, tpr, thresholds = metrics.roc_curve(y, pred) >>> metrics.auc(fpr, tpr) 0.75 
