Skip to content

Instantly share code, notes, and snippets.

View khizirsiddiqui's full-sized avatar

Khizir Siddiqui khizirsiddiqui

View GitHub Profile
@khizirsiddiqui
khizirsiddiqui / auc_roc_pytorch.py
Created April 17, 2021 05:16
AUC ROC Pytorch
def auroc(model, loader_name='val', N_classes=4):
model.eval()
y_test = []
y_score = []
with torch.no_grad():
for i, (inputs, classes) in enumerate(dataloaders[loader_name]):
inputs = inputs.to(device)
y_test.append(F.one_hot(classes, N_classes).numpy())
try: