Artificial intelligence • Original RRTutors lesson
Regression and Classification
Distinguish numeric prediction from category prediction and select evaluation metrics accordingly.
Concept and explanation
Regression predicts a numeric quantity, while classification predicts a class or class probability. Thresholding a probability changes the trade-off between false positives and false negatives. The metric should reflect the use case: mean absolute error is interpretable for many regression tasks; precision, recall, and calibration answer different classification questions.
How to apply it
Specify the target type, baseline, error costs, and decision threshold before comparing models.
Worked example
A model that predicts equipment failure risk may be evaluated by recall at a review capacity limit rather than raw accuracy alone.
Illustrative Python example
from sklearn.metrics import mean_absolute_error
mae = mean_absolute_error(actual_values, predicted_values)
print(f"Mean absolute error: {mae:.2f}")
Expected result
Mean absolute error reports the average absolute prediction difference in target units.
Limitations and cautions
One aggregate metric can hide poor performance for rare outcomes or important subgroups.
Practice exercise
Pick metrics for an imbalanced fraud classifier where missed fraud is costly but reviews are limited.
Key takeaway: Metric choice expresses what errors matter.