rapidsai / cuml

cuML - RAPIDS Machine Learning Library
https://docs.rapids.ai/api/cuml/stable/
Apache License 2.0
4.24k stars 534 forks source link

[FEA] Add implementation for average precision recall score. #3311

Open tzemicheal opened 3 years ago

tzemicheal commented 3 years ago

Is your feature request related to a problem? Please describe. I would like to be able use cuML for average precision recall score (area under precision-recall curve). This is similar to the sklearn.metrics.average_precision_score. I see, there is roc_auc_score and precision_recall_curve under cuML.metrics. I think adding feature for cuML.metrics.average_precision_score is a small additional feature to the metrics module.

Describe the solution you'd like Currently, I am using this implementation to perform average_precision_score using cuML.metrics.precision_recall_curve.

def average_precision_score(y_true, y_score):
     # \\text{AP} = \\sum_n (R_n - R_{n-1}) P_n`
    precision, recall, _ = cuml.metrics.precision_recall_curve(y_true, y_score)
    return -cp.sum(cp.diff(recall) * cp.array(precision)[:-1])

This could be implemented along the same line of _binary_roc_auc_score() method.

Additional context

tzemicheal commented 3 years ago

I can submit PR of my implementation based on similar implementation #1522 .

github-actions[bot] commented 3 years ago

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.

github-actions[bot] commented 3 years ago

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.