Precision и recall для спам-классификатора
Precision и recall для спам-классификатора
Ответить самому
Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.
Короткий ответ
Precision is 90 / 120 = 75%. Recall is 90 / 100 = 90%.
Полный разбор
Precision asks what fraction of predicted positives are correct. The model predicted 120 spam emails, and 90 of them are truly spam:
precision = TP / (TP + FP) = 90 / 120 = 0.75.
Recall asks what fraction of all real positives were found. There are 100 true spam emails, and 90 were predicted as spam:
recall = TP / (TP + FN) = 90 / 100 = 0.9.
The remaining confusion matrix values are FP = 30, FN = 10, TN = 870.
Теория
Precision conditions on model positives; recall conditions on real positives.
Типичные ошибки
- Use all 1000 emails in the denominator for precision or recall.
- Swap precision and recall.
Как отвечать на собеседовании
- Write TP, FP, FN, TN first. The formulas then become mechanical.