Average precision summarizes the precision-recall curve by averaging precision across recall increments. It is useful when a binary target is imbalanced and ranking positive cases matters more than raw accuracy. section 4.2.1
Skewed price target
Classifying listings as above or below the mean price produces 34,016 negative cases and 14,879 positive cases. For this imbalanced target, average precision is preferred alongside ROC-AUC rather than relying on accuracy alone. section 4.2.1
target_mean = (data["price"] > data["price"].mean()).astype(int) target_median = (data["price"] > data["price"].median()).astype(int) target_multiclass = pd.qcut(data["price"], q=5, labels=False) target_regression = data["price"]
Inspect the target transformations that create binary, multiclass, and regression tasks from the price column. section 4.2.1
