Support multilabel metrics
MEMBER
Hi ! Thanks for the fix :)

If I understand correctly, `OptionalSequence` doesn't have an associated arrow type that we know in advance unlike the other feature types, because it depends on the type of the examples.

For example, I tested this and it raises an error:
```python
import datasets as ds
import pyarrow as pa

features = ds.Features({"a": ds.features.OptionalSequence(ds.Value("int32"))})
batch = {"a": [[0]]}

writer = ds.ArrowWriter(features=features, stream=pa.BufferOutputStream())
writer.write_batch(batch)
# ArrowInvalid: Could not convert [0] with type list: tried to convert to int
```
This error happens because `features.type` is `StructType(struct<a: int32>)`.

Another way to add support for multilabel would be to have several configurations for these metrics. By default it would set the features without sequences, and for the multi label configuration it would use features with sequences. Let me know what you think
2021-07-06T09:35:37Z
https://github.com/huggingface/datasets/pull/2589#issuecomment-874612832
https://api.github.com/repos/huggingface/datasets/issues/2589
MDEyOklzc3VlQ29tbWVudDg3NDYxMjgzMg==
https://api.github.com/repos/huggingface/datasets/issues/comments/874612832/reactions
2021-07-06T09:36:07Z
https://api.github.com/repos/huggingface/datasets/issues/comments/874612832
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
MEMBER
Hi @lhoestq, thanks for your feedback :)

Definitely, your suggested approach is simpler. I am going to refactor all my PR unless we could envision some other use cases where an OptionalSequence might be convenient, but for now I can't think of any...
2021-07-06T10:35:07Z
https://github.com/huggingface/datasets/pull/2589#issuecomment-874649937
https://api.github.com/repos/huggingface/datasets/issues/2589
MDEyOklzc3VlQ29tbWVudDg3NDY0OTkzNw==
https://api.github.com/repos/huggingface/datasets/issues/comments/874649937/reactions
2021-07-06T10:35:07Z
https://api.github.com/repos/huggingface/datasets/issues/comments/874649937
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
NONE
@albertvillanova @lhoestq I couldnt find the related docs in F1 card: https://huggingface.co/spaces/evaluate-metric/f1

How do I perform multilabel F1 evaluation using evaluate package?
2022-07-29T09:48:25Z
https://github.com/huggingface/datasets/pull/2589#issuecomment-1199084355
https://api.github.com/repos/huggingface/datasets/issues/2589
IC_kwDODunzps5HeJND
https://api.github.com/repos/huggingface/datasets/issues/comments/1199084355/reactions
2022-07-29T09:48:25Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1199084355
https://avatars.githubusercontent.com/u/34196005?v=4
https://api.github.com/users/fcakyon/events{/privacy}
https://api.github.com/users/fcakyon/followers
https://api.github.com/users/fcakyon/following{/other_user}
https://api.github.com/users/fcakyon/gists{/gist_id}
https://github.com/fcakyon
fcakyon
MDQ6VXNlcjM0MTk2MDA1
https://api.github.com/users/fcakyon/orgs
https://api.github.com/users/fcakyon/received_events
https://api.github.com/users/fcakyon/repos
https://api.github.com/users/fcakyon/starred{/owner}{/repo}
https://api.github.com/users/fcakyon/subscriptions
User
https://api.github.com/users/fcakyon
public
MEMBER
I was going to transfer your question to the `evaluate` GitHub repository, but I saw you have already done it (and even opened a PR):
- https://github.com/huggingface/evaluate/issues/219
- https://github.com/huggingface/evaluate/pull/221

Thanks, @fcakyon. 
2022-07-29T10:47:35Z
https://github.com/huggingface/datasets/pull/2589#issuecomment-1199135696
https://api.github.com/repos/huggingface/datasets/issues/2589
IC_kwDODunzps5HeVvQ
https://api.github.com/repos/huggingface/datasets/issues/comments/1199135696/reactions
2022-07-29T10:47:35Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1199135696
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
NONE
Sorry to bomb you on multiple channels :sweat_smile: @albertvillanova, I have solved my problems, and opened a PR so that others also don't get confused :+1: 
2022-07-29T10:56:24Z
https://github.com/huggingface/datasets/pull/2589#issuecomment-1199142782
https://api.github.com/repos/huggingface/datasets/issues/2589
IC_kwDODunzps5HeXd-
https://api.github.com/repos/huggingface/datasets/issues/comments/1199142782/reactions
2022-07-29T10:56:24Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1199142782
https://avatars.githubusercontent.com/u/34196005?v=4
https://api.github.com/users/fcakyon/events{/privacy}
https://api.github.com/users/fcakyon/followers
https://api.github.com/users/fcakyon/following{/other_user}
https://api.github.com/users/fcakyon/gists{/gist_id}
https://github.com/fcakyon
fcakyon
MDQ6VXNlcjM0MTk2MDA1
https://api.github.com/users/fcakyon/orgs
https://api.github.com/users/fcakyon/received_events
https://api.github.com/users/fcakyon/repos
https://api.github.com/users/fcakyon/starred{/owner}{/repo}
https://api.github.com/users/fcakyon/subscriptions
User
https://api.github.com/users/fcakyon
public
Currently, multilabel metrics are not supported because `predictions` and `references` are defined as `Value("int32")`.

This PR creates a new feature type `OptionalSequence` which can act as either `Value("int32")` or `Sequence(Value("int32"))`, depending on the data passed.


Close #2554.