Machine Learning - Confusion matrix

화이티 ·2023년 12월 17일
0

Machine Learning

목록 보기
2/23
post-thumbnail

🍑Confusion Matrix

Chap06_Logistic Regression, SVM, 분류평가지표, GridSearch.pdf

Overview

Là một phương pháp đánh giá kết quả của những bài toán phân loại với việc xem xét cả những chỉ số về độ chính xác và độ bao quát của các dự đoán cho từng lớp

it is a performance measurement for machine learning classification problem where output can be two or more classes. It is a table with 4 different combinations of predicted and actual values.

1. Accuracy

Accuracy is used to measure the performance of the model. It is the ratio of Total correct instances to the total instance

Untitled

Example:

Untitled

  • True Positive (TP): It is the total counts having both predicted and actual values are Dog.
  • True Negative (TN): It is the total counts having both predicted and actual values are Not Dog.
  • False Positive (FP): It is the total counts having prediction is Dog while actually Not Dog.
  • False Negative (FN): It is the total counts having prediction is Not Dog while actually, it is Dog.

2. Recall

Untitled

Recall: measures the effectiveness of a classification model in identifying all relevant instances from a dataset. It is the ratio of the number of true positive (TP) instances to the sum of true positive and false negative (FN) instances.

recall : 재현율, 애매한거 사용

3. Precision

Precision:  is a measure of how accurate a model’s positive predictions are. It is defined as the ratio of true positive predictions to the total number of positive predictions made by the model

precision: 정밀도, 애매한거 사용 안함

Untitled

4. F1 -score

F1-score is used to evaluate the overall performance of a classification model.

It is the harmonic mean of precision and recall

정밀도와 재현율의 조화평균

Untitled


Untitled

Example:

knn.fit(x_train,y_train)
# knn model 사용
y_pred = knn.predict(x_test)
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))

Untitled

Explaination:

  • recall : 재현율, 애매한거 사용
  • precision: 정밀도, 애매한거 사용 안함
  • f1-score: 정밀도와 재현율의 조화평균
  • 솃다 0~1까지의 값을 갖는다, 1에 가까울수록 좋음
  • support : 데이터 수
  • accuracy: 전체중에 맞춘비율
  • macro avg: 단순 평균
  • weighted avg : 가중평균, 값이 많은 데이터가 높은 가중치를 갖는다 =
profile
열심히 공부합시다! The best is yet to come! 💜

0개의 댓글