Close
Sidebar
Search tutorials
Get Started
Documentation
XCurve.Losses.AdversarialAUROC
The AdversarialAUROC consists of two parts:AdvAUROCLoss
, and RegAdvAUROCLoss
.
AdvAUROCLoss
The following class supports the computation of AdvAUROCLoss: CLASS AdvAUROCLoss (imratio=None, a=None, b=None, alpha=None) [SOURCE]
|
The imbalance ration in your dataset. It must be precisely estimated based on your training set, i.e., $\frac{\#Pos.Num}{\#Tot.Num}$. The initial values for a, b, $\alpha$ in instance-wise AUROC loss (Default=0.0). |
---|
CLASS AdvAUCOptimizer (params, a, b, alpha, lr=required, momentum=0.9, dampening=0, weight_decay=0, nesterov=False)
Example:
import torch
from XCurve.AUROC.losses import AdvAUROCLoss
feats = torch.rand(16).cuda()
targets = torch.tensor([0,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0]).cuda()
criterion_AdvAUROC = AdvAUROCLoss()
loss_AdvAUROC = criterion_AdvAUROC(feats, targets)
print(loss_AdvAUROC.item())
RegAdvAUROCLoss
CLASS RegAdvAUROCLoss (imratio=None, a=None, b=None, alpha=None, lambda1=None, lambda2=None) [SOURCE]
|
The imbalance ration in your dataset. It must be precisely estimated based on your training set, i.e., $\frac{\#Pos.Num}{\#Tot.Num}$. The initial values for a, b, $\alpha$ in instance-wise AUROC loss (Default=0.0). The initial coefficient values for regularization (Default=1.0). |
---|
CLASS RegAdvAUCOptimizer (params, a, b, alpha, lambda1, lambda2, c1=1, c2=1, gamma=1, lamda=1, lr=required)
Example:
import torch
from XCurve.AUROC.losses import RegAdvAUROCLoss
feats = torch.rand(16).cuda()
targets = torch.tensor([0,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0]).cuda()
criterion_RegAdvAUROC = RegAdvAUROCLoss()
loss_RegAdvAUROC = criterion_RegAdvAUROC(feats, targets)
print(loss_RegAdvAUROC.item())