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

audmetric.utils.infer_labels() can fail for NaN #12

Open
hagenw opened this issue Dec 15, 2021 · 0 comments · May be fixed by #13
Open

audmetric.utils.infer_labels() can fail for NaN #12

hagenw opened this issue Dec 15, 2021 · 0 comments · May be fixed by #13
Labels
bug Something isn't working

Comments

@hagenw
Copy link
Member

hagenw commented Dec 15, 2021

If you have a mixture of string entries and NaN, audmetric.utils.infer_labels() will fail:

>>> audmetric.utils.infer_labels(['a', 'b'], ['a', np.NaN])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-c5231a7963ad> in <module>
----> 1 audmetric.utils.infer_labels(['a', 'b'], ['a', np.NaN])

~/git/audeering/audmetric/audmetric/core/utils.py in infer_labels(truth, prediction)
     33 
     34     """
---> 35     return sorted(list(set(truth) | set(prediction)))
     36 
     37 

TypeError: '<' not supported between instances of 'str' and 'float'

whereas the expected result should be ['a', 'b'].

@hagenw hagenw added the bug Something isn't working label Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant