1

I have a code bit that i'm trying to duplicate except for my matches being encoded I just have a binary 0 or 1 for my data in the field that is to be indexed. If i substitute 1 or 0 for the "normal." I receive an error stating that it is not in the list. I'm not sure how to transform this line of code to pick recognize a 0 or a 1 to receive an auc score.

anomalies_test = anomaly_scores_test > -0.19
matches = y_test == list(encoded.classes_).index("normal.")
auc = roc_auc_score(anomalies_test, matches)
print("AUC: {:.2%}".format (auc))

error:

ValueError: 'normal.' is not in list # due to only being 1 or 0
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Chris Kehl
  • 11
  • 3

0 Answers0