概念
Model performance metrics
Accuracy, precision, recall, F1 and AUC-ROC score classifiers. MAE, RMSE and R squared score number predictions.
このレッスンはまだ翻訳されていないため、英語で表示しています。
Accuracy
- Asks
- How many predictions were right?
- Matters when
- Classes are balanced
- Example
- Cats and dogs in equal numbers
Precision
- Asks
- Of the flagged, how many were right?
- Matters when
- False alarms are costly
- Example
- Spam filter
Recall
- Asks
- Of the real cases, how many were found?
- Matters when
- Missing a case is costly
- Example
- Fraud detection
F1 score
- Asks
- How good is the balance of both?
- Matters when
- You need both
- Example
- Rare events
AUC-ROC
- Asks
- How well are the two classes separated?
- Matters when
- 0.5 is guessing, 1 is perfect
- Example
- Fraud model ranking
MAE
- Asks
- What is the average size of the error?
- Matters when
- Predicting a number. Lower is better
- Example
- House price
RMSE
- Asks
- Like MAE, but big errors count more
- Matters when
- Big misses are costly. Lower is better
- Example
- Price prediction
MAPE
- Asks
- What is the average error as a percent?
- Matters when
- Forecasts. Lower is better
- Example
- Demand forecast
R squared
- Asks
- How much of the change does the model explain?
- Matters when
- Closer to 1 is better
- Example
- Fit of a price model
| Metric | Asks | Matters when | Example |
|---|---|---|---|
| Accuracy | How many predictions were right? | Classes are balanced | Cats and dogs in equal numbers |
| Precision | Of the flagged, how many were right? | False alarms are costly | Spam filter |
| Recall | Of the real cases, how many were found? | Missing a case is costly | Fraud detection |
| F1 score | How good is the balance of both? | You need both | Rare events |
| AUC-ROC | How well are the two classes separated? | 0.5 is guessing, 1 is perfect | Fraud model ranking |
| MAE | What is the average size of the error? | Predicting a number. Lower is better | House price |
| RMSE | Like MAE, but big errors count more | Big misses are costly. Lower is better | Price prediction |
| MAPE | What is the average error as a percent? | Forecasts. Lower is better | Demand forecast |
| R squared | How much of the change does the model explain? | Closer to 1 is better | Fit of a price model |
1 / 5
Accuracy
- Asks
- How many predictions were right?
- Matters when
- Classes are balanced
- Example
- Cats and dogs in equal numbers
Precision
- Asks
- Of the flagged, how many were right?
- Matters when
- False alarms are costly
- Example
- Spam filter
| Metric | Asks | Matters when | Example |
|---|---|---|---|
| Accuracy | How many predictions were right? | Classes are balanced | Cats and dogs in equal numbers |
| Precision | Of the flagged, how many were right? | False alarms are costly | Spam filter |
2 / 5
Recall
- Asks
- Of the real cases, how many were found?
- Matters when
- Missing a case is costly
- Example
- Fraud detection
F1 score
- Asks
- How good is the balance of both?
- Matters when
- You need both
- Example
- Rare events
| Metric | Asks | Matters when | Example |
|---|---|---|---|
| Recall | Of the real cases, how many were found? | Missing a case is costly | Fraud detection |
| F1 score | How good is the balance of both? | You need both | Rare events |
3 / 5
AUC-ROC
- Asks
- How well are the two classes separated?
- Matters when
- 0.5 is guessing, 1 is perfect
- Example
- Fraud model ranking
MAE
- Asks
- What is the average size of the error?
- Matters when
- Predicting a number. Lower is better
- Example
- House price
| Metric | Asks | Matters when | Example |
|---|---|---|---|
| AUC-ROC | How well are the two classes separated? | 0.5 is guessing, 1 is perfect | Fraud model ranking |
| MAE | What is the average size of the error? | Predicting a number. Lower is better | House price |
4 / 5
RMSE
- Asks
- Like MAE, but big errors count more
- Matters when
- Big misses are costly. Lower is better
- Example
- Price prediction
MAPE
- Asks
- What is the average error as a percent?
- Matters when
- Forecasts. Lower is better
- Example
- Demand forecast
| Metric | Asks | Matters when | Example |
|---|---|---|---|
| RMSE | Like MAE, but big errors count more | Big misses are costly. Lower is better | Price prediction |
| MAPE | What is the average error as a percent? | Forecasts. Lower is better | Demand forecast |
5 / 5
R squared
- Asks
- How much of the change does the model explain?
- Matters when
- Closer to 1 is better
- Example
- Fit of a price model
| Metric | Asks | Matters when | Example |
|---|---|---|---|
| R squared | How much of the change does the model explain? | Closer to 1 is better | Fit of a price model |
Caught
Fraud flagged as fraud. Good.
False alarm
A good payment flagged. Hurts precision.
Missed
Fraud let through. Hurts recall.
Cleared
A good payment passed. Good.
概要
Accuracy is the share of all predictions that were right. It can mislead: if 99 of 100 transactions are fine, a model that always says fine is 99 percent accurate, and useless.
Precision asks: of the items the model flagged, how many were truly positive? Recall asks: of all the truly positive items, how many did the model find? F1 score combines both into one number.
Which one matters depends on the cost of a mistake. For fraud or disease, a missed case is costly, so recall matters. For a spam filter, a false alarm hides a good email, so precision matters.
概要
These all come from the confusion matrix, a table of the four outcomes (see the cards). AUC-ROC measures how well a model separates two classes: 0.5 is no better than guessing and 1 is perfect.
A model that predicts a number, such as a price, is scored by its error, so lower is better. MAE is the average size of the error. RMSE is similar but counts big errors more. MAPE gives the error as a percent. R squared shows how much of the change in the answer the model explains, and closer to 1 is better.
覚えること
- Accuracy misleads when one class is rare.
- Precision: of the flagged items, how many were right. Recall: of the real cases, how many were found.
- F1 score balances precision and recall. Fraud and disease favor recall, spam favors precision.
- AUC-ROC: 0.5 is guessing, 1 is perfect.
覚えること
- Predicting a number: MAE, RMSE and MAPE, where lower is better.
- R squared: closer to 1 is better.
試験では
- “Missing a fraud case is very costly” points to recall.
- “Avoid false alarms” points to precision.
- “Balance precision and recall in one score” points to the F1 score.
- “Predict a price” or another number points to RMSE or MAE to judge the model.