计算F1、准确率(Accuracy)、召回率(Recall)、精确率(Precision)、敏感性(Sensitivity)、特异性(Specificity)需要用到的包(PS:还有一些如AUC等后面再加上用法。) fromsklearn.metricsimportprecision_recall_curve,average_precision_score,roc_curve,auc,precision_score,recall_score,f1_score,confusion_matrix,accuracy_...
device=torch.device('cuda'iftorch.cuda.is_available()else'cpu')model=YourModel().to(device)metric=torchmetrics.Accuracy()forbatch_idx,(data,target)inenumerate(val_dataloader):data,target=data.to(device),target.to(device)output=model(data)# metric on current batch batch_acc=metric.update(preds...