tensorflow / addons

Useful extra functionality for TensorFlow 2.x maintained by SIG-addons
Apache License 2.0
1.69k stars 612 forks source link

Input size for F1 Score #1953

Closed KacperKubara closed 4 years ago

KacperKubara commented 4 years ago

System information

Describe the bug Hi, I wanted to ask what input shape is allowed for F1 Score metric in the library. Should the y_true and y_pred vectors be one hot encoded, e.g. [batch_size, no_labels], or contain label of the prediciton, e.g. [batch_size]? Can I make it work with raw softmax values as well? Can't find any reference to this in docs.

WindQAQ commented 4 years ago

cc @AakashKumarNain who might understand metrics more.

AakashKumarNain commented 4 years ago

Thanks @WindQAQ

@KacperKubara It should work in both the cases, i.e. OHE as well as with the softmax scores. If something isn't working, please let us know. We will also update the documentation for F1 score in the next version. Thank you for the inputs

KacperKubara commented 4 years ago

That's good to know, thanks @AakashKumarNain. I've had some issues with F1 score but it seems that it was because of my misunderstanding. If I will encounter any bugs, I will open another issue.

I am happy to hear that docs will updated for F1 scores. On the sidenote, while the TFA seems to be a great addition to TF, the lack of docs (especially for metrics) refrained me from actually using it and looking for alternatives. The implementation code for metrics is also quite complicated and uses a lot of inheritance which makes it quite difficult to figure out what's going on by yourself. I will close this issue for now.

AakashKumarNain commented 4 years ago

@KacperKubara thanks for the feedback. We will take this into account and will try our best to improve the end-user experience. On a side not, if you think that the documentation of particular functionality in TFA isn't proper, please feel free to open an issue and we will look into it.