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

Calculating F1 fails due to error(AttributeError: 'float' object has no attribute 'size') #658

Open
Gholamrezadar opened this issue Jan 8, 2025 · 2 comments

Comments

@Gholamrezadar
Copy link

When I try to calculate f1 score I get this error:

return {"f1": float(score) if score.size == 1 else score}
                                   ^^^^^^
AttributeError: 'float' object has no attribute 'size'

Code to Reproduce

import evaluate
f1_metric = evaluate.load("f1")
result = f1_metric.compute(predictions=[0, 1], references=[0, 1])
print(result["f1"])
  • Tested on a default github codespaces environment and google colab.
  • evaluate==0.4.3
@d-gurgurov
Copy link

Experiencing the same issue with the last three versions of evaluate :(

@d-gurgurov
Copy link

#655 - the solution is here. there is an inconsistency caused by the scikit-learn update

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

No branches or pull requests

2 participants