We should consider changing the metrics API. Rather than having individual metrics be functions, we should consider creating a GroupedData object which would accept y_true, y_pred and group_membership as constructor arguments (and optionally sample_weights). Individual metrics would then become methods on that (still returning a GroupMetricResult object). Users would specify their own metrics via an apply_function(my_metric_function) method (where my_metric_function took arguments of y_true, y_pred and sample_weights).
We should consider changing the metrics API. Rather than having individual metrics be functions, we should consider creating a
GroupedDataobject which would accepty_true,y_predandgroup_membershipas constructor arguments (and optionallysample_weights). Individual metrics would then become methods on that (still returning aGroupMetricResultobject). Users would specify their own metrics via anapply_function(my_metric_function)method (wheremy_metric_functiontook arguments ofy_true,y_predandsample_weights).