Posts ai practice 1
Post
Cancel

ai practice 1

모델 성능 측정 지표



img

  • True Positive: 모델은 A일 것이라 예측하였고 실제로 그런 경우
  • True Negative: 모델은 A가 아닐 것이라 예측하였고 실제로 그런 경우
  • False Positive: 모델은 A일 것이라 예측하였고 실제로는 아닌 경우
  • False Negative: 모델은 A가 아닐 것이라 예측하였고 실제로는 아닌 경우


Accuracy


올바르게 예측된 데이터의 수를 전체 데이터의 수로 나눈 값.

img



Precision


정밀도: 모델이 True로 예측한 데이터 중 실제로 True인 데이터의 수

img

1
precision = 1.0 * num_same / len(prediction_Char)



Recall


재현율: 실제로 True인 데이터를 모델이 True라고 인식한 데이터의 수

img

1
recall = 1.0 * num_same / len(ground_truth_Char)

Recall과 Precision은 trade-off되는 관계

F1 Score


Precision과 Recall의 조화평균

img

1
2
3
4
5
6
7
8
9
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score

labels = [1, 0, 0, 1, 1, 1, 0, 1, 1, 1]	# 실제 labels
guesses = [0, 1, 1, 1, 1, 0, 1, 0, 1, 0]	# 에측된 결과

print(accuracy_score(labels, guesses))	# 0.3
print(precision_score(labels, guesses))	# 0.5
print(recall_score(labels, guesses))	# 0.42
print(f1_score(labels, guesses))	# 0.46
This post is licensed under CC BY 4.0 by the author.