Data Science Cheat Sheet

IT 위키
핵톤 (토론 | 기여)님의 2024년 11월 4일 (월) 14:12 판 (Created page with "== Confusion Matrix and F1 Score == '''Confusion Matrix''' {| class="wikitable" |- ! !!Predicted Positive!!Predicted Negative |- |'''Actual Positive'''||True Positive (TP)||False Negative (FN) |- |'''Actual Negative'''||False Positive (FP)||True Negative (TN) |} '''F1 Score''' = 2 * (Precision * Recall) / (Precision + Recall) * 2 * (Positive Predictive Value * True Positive Rate) / (Positive Predictive Value + True Positive Rate) * 2 * (TP) / (TP + FP + FN) ==...")
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

Confusion Matrix and F1 Score

Confusion Matrix

Predicted Positive Predicted Negative
Actual Positive True Positive (TP) False Negative (FN)
Actual Negative False Positive (FP) True Negative (TN)

F1 Score = 2 * (Precision * Recall) / (Precision + Recall)

  • 2 * (Positive Predictive Value * True Positive Rate) / (Positive Predictive Value + True Positive Rate)
  • 2 * (TP) / (TP + FP + FN)

Key Evaluation Metrics

True Positive Rate (TPR), Sensitivity, Recall

  • TPR = Sensitivity = Recall = TP / (TP + FN)

Precision (Positive Predictive Value)

  • Precision = TP / (TP + FP)

Specificity (True Negative Rate, TNR)

  • Specificity = TNR = TN / (TN + FP)

False Positive Rate (FPR)

  • FPR = FP / (FP + TN)

Negative Predictive Value (NPV)

  • NPV = TN / (TN + FN)

Accuracy

  • Accuracy = (TP + TN) / (TP + TN + FP + FN)

Relationships between Key Concepts

TPR (Recall) and Precision:

  • TPR represents the proportion of actual positives correctly predicted by the model, while Precision shows the proportion of predicted positives that are actually positive.
    • Increasing TPR (Recall) can sometimes reduce Precision, and vice versa.

FPR and Specificity:

  • Specificity = (1 - FPR). In an ROC curve, FPR is plotted on the x-axis and TPR on the y-axis to visualize model performance.

F1 Score:

  • Defined as the harmonic mean of Precision and Recall, emphasizing their balance. F1 Score = 2 * (Precision * Recall) / (Precision + Recall)

Accuracy:

  • Accuracy reflects the overall model performance but may not be suitable in cases of class imbalance.