Skip to content

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

@hagenw

Description

@hagenw

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'].

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions