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

MSE not accepting (n_samples, n_ouptuts) despite docs stating so #550

Open
bauersimon opened this issue Feb 18, 2024 · 2 comments
Open

MSE not accepting (n_samples, n_ouptuts) despite docs stating so #550

bauersimon opened this issue Feb 18, 2024 · 2 comments

Comments

@bauersimon
Copy link

The evaluation card for MSE states:


Mandatory inputs:

  • predictions: numeric array-like of shape (n_samples,) or (n_samples, n_outputs), representing the estimated target values.
  • references: numeric array-like of shape (n_samples,) or (n_samples, n_outputs), representing the ground truth (correct) target values.

So it should be usable similar to pytorch's MSELoss with multiple dimensions.
But using it with (batch_size, multiple_outputs) doesn't work:

import evaluate
import numpy as np

m = evaluate.load('mse')
print(m.compute(predictions=np.random.rand(16,2), references=np.random.rand(16,2)))

⬇️

ValueError: Predictions and/or references don't match the expected format.
Expected format: {'predictions': Value(dtype='float32', id=None), 'references': Value(dtype='float32', id=None)},
Input predictions: ...
Input references: ...

Version: evaluate==0.4.1

@shenxiangzhuang
Copy link

Hi @bauersimon , the quick answer for your question is:

import evaluate
import numpy as np

- m = evaluate.load('mse')
+ m = evaluate.load('mse', 'multilist')
print(m.compute(predictions=np.random.rand(16,2), references=np.random.rand(16,2)))

And, the error message is also too vague to address the problem.

@bauersimon
Copy link
Author

Thanks! Should probably be mentioned in the docs then 😅.

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