2.6 Metrics and the confusion matrix

NCA-ADS · Machine Learning With RAPIDS (16% of the exam) · Official objective: “Performance metrics and confusion matrix interpretation”

Precision, recall, the confusion matrix, and robust regression metrics.

Key points

  1. Precision = true positives / (true positives + false positives) = 80/100. Recall = true positives / (true positives + false negatives) = 80/200.

    What NVIDIA says (2)

    “The precision is the ratio tp / (tp + fp) where tp is the number of true positives and fp the number of false positives.”

    — cuML API: precision_recall_curve

    “The recall is the ratio tp / (tp + fn) where tp is the number of true positives and fn the number of false negatives.”

    — cuML API: precision_recall_curve

  2. A confusion matrix counts how often each true class was predicted as each class. Off-diagonal cells are mistakes.

    What NVIDIA says (1)

    “Normalizes confusion matrix over the true (rows), predicted (columns) conditions or al”

    — cuML API: confusion_matrix

  3. Recall measures how many positives you catch. When misses are expensive, high recall matters most, even at some cost in precision.

    What NVIDIA says (1)

    “The recall is intuitively the ability of the classifier to find all the positive samples.”

    — cuML API: precision_recall_curve

  4. MSE squares each error, so a few big errors dominate it. MAE averages absolute errors, so it is more robust to outliers.

    What NVIDIA says (2)

    “Some of those might be outliers, so MSE is not robust to their presence.”

    — A Comprehensive Overview of Regression Evaluation Metrics

    “Other than the scale, RMSE has the same properties as MSE.”

    — A Comprehensive Overview of Regression Evaluation Metrics

Key terms

Try it

Sample question

A fraud model flags 100 transactions; 80 are fraud. There were 200 fraud cases in total. What are precision and recall?

Show the answer

Answer: Precision 0.80, recall 0.40

Precision = true positives / (true positives + false positives) = 80/100. Recall = true positives / (true positives + false negatives) = 80/200.

What NVIDIA says (2)

“The precision is the ratio tp / (tp + fp) where tp is the number of true positives and fp the number of false positives.”

— cuML API: precision_recall_curve

“The recall is the ratio tp / (tp + fn) where tp is the number of true positives and fn the number of false negatives.”

— cuML API: precision_recall_curve

Practice 2.6 (4 questions) Full Machine Learning With RAPIDS guide

← 2.5 Cross-validation · 3.1 Designing an end-to-end pipeline →