AUC¶
Module Interface¶
- class torchmetrics.AUC(reorder=False, **kwargs)[source]
Computes Area Under the Curve (AUC) using the trapezoidal rule
Forward accepts two input tensors that should be 1D and have the same number of elements
- Parameters
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Functional Interface¶
- torchmetrics.functional.auc(x, y, reorder=False)[source]
Computes Area Under the Curve (AUC) using the trapezoidal rule.
- Parameters
- Return type
- Returns
Tensor containing AUC score
- Raises
ValueError – If both
x
andy
tensors are not1d
.ValueError – If both
x
andy
don’t have the same numnber of elements.ValueError – If
x
tesnsor is neither increasing nor decreasing.
Example
>>> from torchmetrics.functional import auc >>> x = torch.tensor([0, 1, 2, 3]) >>> y = torch.tensor([0, 1, 2, 2]) >>> auc(x, y) tensor(4.) >>> auc(x, y, reorder=True) tensor(4.)