- class ignite.contrib.metrics.ROC_AUC(output_transform=<function ROC_AUC.<lambda>>, check_compute_fn=False, device=device(type='cpu'))#
Computes Area Under the Receiver Operating Characteristic Curve (ROC AUC) accumulating predictions and the ground-truth during an epoch and applying sklearn.metrics.roc_auc_score .
output_transform (Callable) – a callable that is used to transform the
process_function’s output into the form expected by the metric. This can be useful if, for example, you have a multi-output model and you want to compute the metric with respect to one of the outputs.
ROC_AUC expects y to be comprised of 0’s and 1’s. y_pred must either be probability estimates or confidence values. To apply an activation to y_pred, use output_transform as shown below:
def activated_output_transform(output): y_pred, y = output y_pred = torch.sigmoid(y_pred) return y_pred, y roc_auc = ROC_AUC(activated_output_transform)