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
Note
This metric has been deprecated in v0.10 and will be removed in v0.11.
- Parameters
reorder¶ (
bool
) – AUC expects its first input to be sorted. If this is not the case, setting this argument toTrue
will use a stable sorting algorithm to sort the input in descending orderkwargs¶ (
Any
) – Additional keyword arguments, see Advanced metric settings for more info.
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.
Note
This metric have been moved to torchmetrics.utilities.compute in v0.10 this version will be removed in v0.11.
- 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.)