← 返回 rippling 的题目列表Pandas GroupBy Aggregation for Precision/Recall
类型:online_judge
You are given a classification model output dataset as a Pandas DataFrame, containing ground-truth labels and model predictions (and possibly prediction scores). Using pandas:
Use groupby to aggregate the DataFrame to compute classification metrics either overall or grouped by a given dimension.
Compute precision and recall for binary classification:
precision = TP / (TP + FP)
recall = TP / (TP + FN)
Constraints / format:
Must use pandas (code can be executed).
No test cases are provided.
Column names and grouping dimension are not specified in the post; assume at least y_true and y_pred (or equivalent) exist.