Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expired deprecations in scipy v1.14 release break river metric #1574

Closed
bdewilde opened this issue Jul 13, 2024 · 1 comment · Fixed by #1568
Closed

Expired deprecations in scipy v1.14 release break river metric #1574

bdewilde opened this issue Jul 13, 2024 · 1 comment · Fixed by #1568

Comments

@bdewilde
Copy link

Versions

river version: 0.21.2
Python version: 3.11.7
Operating system: macOS 14.4

Describe the bug

When following along with the sentence classification example, the core training loop did not succeed as documented, but instead errored:

File [~/.pyenv/versions/3.11.7/envs/ds/lib/python3.11/site-packages/river/metrics/roc_auc.py:103](http://localhost:8888/lab/tree/~/.pyenv/versions/3.11.7/envs/ds/lib/python3.11/site-packages/river/metrics/roc_auc.py#line=102), in ROCAUC.get(self)
    100     tprs[i] = safe_div(a=tp, b=tp + fn)
    101     fprs[i] = safe_div(a=fp, b=fp + tn)
--> 103 return -integrate.trapz(x=fprs, y=tprs)

AttributeError: module 'scipy.integrate' has no attribute 'trapz'

As far as I can tell, the issue is that the June release of scipy v1.14.0 included a number of "expired deprecations", and integrate.trapz has been removed in favor of integrate.trapezoid,

Steps/code to reproduce

import river.datasets
import river.feature_extraction
import river.metrics
import river.naive_bayes


X_y = river.datasets.SMSSpam()
model = (
    river.feature_extraction.TFIDF(on='body') | 
    river.naive_bayes.BernoulliNB(alpha=0)
)
metric = river.metrics.ROCAUC()
cm = river.metrics.ConfusionMatrix()

for x, y in X_y:
    y_pred = model.predict_one(x)
    if y_pred is not None:
        metric.update(y_pred=y_pred, y_true=y)
        cm.update(y_pred=y_pred, y_true=y)
    model.learn_one(x, y)
@bdewilde
Copy link
Author

Oh, nice: Looks like PR #1568 has the fix.

@gbolmier gbolmier linked a pull request Jul 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant