Skip to content

Commit

Permalink
Fixed AttributeError in metrics/roc_auc.py.
Browse files Browse the repository at this point in the history
`scipy.integrate.trapezoid` replaced `scipy.integrate.trapz` in SciPy.
  • Loading branch information
RavSS committed Jul 7, 2024
1 parent acaf678 commit d6a01e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion river/metrics/roc_auc.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,10 @@ def safe_div(a, b):
tprs[i] = safe_div(a=tp, b=tp + fn)
fprs[i] = safe_div(a=fp, b=fp + tn)

return -integrate.trapz(x=fprs, y=tprs)
trapezoid = (
integrate.trapz # For older/outdated versions of SciPy.
if hasattr(integrate, "trapz")
else integrate.trapezoid
)

return -trapezoid(x=fprs, y=tprs)

0 comments on commit d6a01e5

Please sign in to comment.