Sidebar
Search tutorials
Get Started
Documentation
XCurve.Losses.AUROC
The StandardAUROC Loss consists of three parts:SquareAUCLoss
, HingeAUCLoss
, and ExpAUCLoss
.
SquareAUCLoss
The following class supports the computation of SquareAUCloss: CLASS SquareAUCLoss (num_classes, gamma=1, transform='ovo', **kwargs) [SOURCE]
|
The number of classes in the classification problem. The safe margin for the loss (default=1.0). The manner of computing the multi-class AUROC Metric, either 'ovo' or 'ova' (default as 'ovo' in our paper). |
---|
Example:
import torch
from XCurve.AUROC.losses import SquareAUCLoss
feats = torch.softmax(torch.randn(16, 9).cuda(), dim=1)
targets = torch.tensor([0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1]).cuda()
criterion_Square = SquareAUCLoss(
num_classes=9,
gamma=1.0,
transform="ovo")
loss_Square = criterion_Square(feats, targets)
print(loss_Square.item())
HingeAUCLoss
The following class supports the computation of HingeAUCloss: CLASS HingeAUCLoss (num_classes, gamma=1, transform='ovo', **kwargs) [SOURCE]
|
The number of classes in the classification problem. The safe margin for the loss (default=1.0). The manner of computing the multi-class AUROC Metric, either 'ovo' or 'ova' (default as 'ovo' in our paper). |
---|
Example:
import torch
from XCurve.AUROC.losses import HingeAUCLoss
feats = torch.softmax(torch.randn(16, 9).cuda(), dim=1)
targets = torch.tensor([0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1]).cuda()
criterion_Hinge = HingeAUCLoss(
num_classes=9,
gamma=1.0,
transform="ovo")
loss_Hinge = criterion_Hinge(feats, targets)
print(loss_Hinge.item())
ExpAUCLoss
The following class supports the computation of ExpAUCloss: CLASS ExpAUCLoss (num_classes, gamma=1, transform='ovo', **kwargs) [SOURCE]
|
The number of classes in the classification problem. The safe margin for the loss (default=1.0). The manner of computing the multi-class AUROC Metric, either 'ovo' or 'ova' (default as 'ovo' in our paper). |
---|
Example:
import torch
from XCurve.AUROC.losses import ExpAUCLoss
feats = torch.softmax(torch.randn(16, 9).cuda(), dim=1)
targets = torch.tensor([0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1]).cuda()
criterion_Exp = ExpAUCLoss(
num_classes=9,
gamma=1.0,
transform="ovo")
loss_Exp = criterion_Exp(feats, targets)
print(loss_Exp.item())