Closed AmritaBh closed 6 months ago
Hi, thanks for your interest in the project. Below is code snippet you can use to compute AUC using standard pandas and sklearn libs.
from sklearn import metrics
# df is pandas dataframe with ground truth `sample_class` (1 for AI-generated, 0 for human-generated text)
score = "binoculars_score"
label = "sample_class"
df[score] *= -1 # reverse scale so that higher score indicates positive/AI-generated class
fpr, tpr, _ = metrics.roc_curve(y_true=df[label], y_score=df[score], pos_label=1)
roc_auc = metrics.auc(fpr, tpr)
Hopefully, this should help you out. I'm closing this issue, but please feel free to comment if you further face any issues.
The additional results in the appendix section of the paper report AUC scores. How do you compute the AUROC scores using the binocular scores? A script to do this or pseudocode would be super helpful. Thanks!