미해결
[개정판] 파이썬 머신러닝 완벽 가이드
roc_curve 함수에서 반환하는 fpr, tpr, threshold의 갯수를 늘려줄 수 있을까요?
안녕하세요. 먼저 테스트 데이터가 그렇게 많지는 않습니다. 그런 상태에서 roc_curve 평가지표를 찍어봤을 때 index 개수가 얼마 나오지 않아서 질문을 드립니다. 그래서 그런지 threshold가 조금 최적화가 덜되는 것 같아서요
distances = (tpr - 1.) ** 2 + fpr ** 2 # distances from (1,0) in roc curve
best_index = np.argmin(distances)
#그래서 주석이 아닌 아래 threshold 값을 쓰고 있습니다
threshold = (thresholds[best_index] + thresholds[best_index +1]) / 2
# threshold = thresholds[best_index]