i = np.argmax(f1) # 가장 큰 F1 점수의 인덱스
plt.plot(ths, f1)
best_threshold = ths[i] # 가장 큰 F1 점수의 임계값
best_f1 = f1[i] # 가장 큰 F1 점수
plt.plot((best_threshold, best_threshold), (0, best_f1), color='r', linestyle='--')
plt.plot(best_threshold, best_f1, 'ro') # 가장 큰 F1 점수 지점 표시
plt.xlabel('Threshold')
plt.ylabel('F1 Score')
best_threshold, best_f1
ROC 곡선 (Receiver Operating Characteristic Curve)
신호 이론에서 유래
가로축은 1-특이도(FPR), 세로축은 재현도(TPR)
문턱값을 변화시키면서 특이도와 재현도의 변화를 곡선으로 표시
무작위로 예측할 경우 TPR=FPR인 직선
곡선하 면적(Area Under the Curve; AUC)은 0~1 범위 → 클 수록 높은 성능