LightMySky
به انگلیسی

Beyond Accuracy: Precision, Recall and the Cost of an Error

On imbalanced data a model that always says no can be right almost every time and be useless. The confusion matrix separates the two kinds of mistake, and precision, recall and the curves over thresholds say which model suits which cost.

شروع یادگیری این موضوعبه حساب کاربری نیازی نیست. پیشرفت در همین مرورگر ذخیره می‌شود.

کارهایی که یادگیرنده بعد از این درس می‌تواند انجام دهد

  • Build a confusion matrix and compute precision and recall from it
  • Show a case where high accuracy hides a model that never finds the rare class
  • Choose a threshold from a stated cost of a miss against a cost of a false alarm

۱ · بخوان

Accuracy says how often the model is right overall, counting every guess the same way. You already keep one set of data untouched, the testing set, and score on it once at the end so the number stays honest. A model great on training but poor on new data is overfitting: it memorised the practice. What it still hides is which mistakes the model makes, and on rare events that is everything.

Try it together

Picture 100 patients where 99 are healthy and 1 is sick. A lazy model that always says healthy scores 99 percent, yet finds zero sick patients. Overall accuracy looks superb while the rare class is missed entirely. That is the trap: on imbalanced data, always guessing the common answer is accurate and useless.

The confusion matrix escapes the trap by separating the two kinds of mistake: the miss, a sick patient called healthy, and the false alarm, a healthy patient called sick. Precision is the share of yes calls that are truly sick, and recall is the share of sick patients found. Threshold curves then say which model suits which cost. Binary problems like spam or not spam live here, since there are exactly two mistakes to weigh.

Choose the threshold from the stated costs. When a miss costs far more than a false alarm, catch more cases even at the price of extra alarms.

Split train from test, distrust lone accuracy on rare events, and set the threshold from the cost of each mistake.

The rewritten readings were written for this dataset.

۲ · ببین

به انگلیسی

دور از صفحه‌نمایش

چاپ کاربرگکاغذ A4، با یک صفحهٔ جواب‌ها برای بزرگ‌ترها. بدون صفحه‌نمایش، بدون اینترنت.

جایگاه این موضوع

سپس تمرین

۸ سؤال پشت این درس منتظرند، هر کدام با پاسخ توضیح‌داده‌شده. هر پاسخ آسمان را پر می‌کند: ستاره‌ها هنگام یادگیری روشن می‌شوند و وقتی زمان برگشتن است کمرنگ می‌شوند.

شروع یادگیری این موضوع