Skip to content

Instantly share code, notes, and snippets.

@e96031413
Last active February 21, 2022 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e96031413/fc7f8996056941b1ed73a5dce69c81c1 to your computer and use it in GitHub Desktop.
Save e96031413/fc7f8996056941b1ed73a5dce69c81c1 to your computer and use it in GitHub Desktop.
import numpy as np
from sklearn import metrics
from sklearn.metrics import roc_auc_score
y = np.array([1, 1, 2, 2])
#scores可以是模型預測結果(Label)
#scores也可以是模型預測的confidence(softmax probability)
scores = np.array([1, 1, 2, 2])
scores = np.array([0.1, 0.4, 0.35, 0.8])
area_under_curve = roc_auc_score(y, scores)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment