Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Classification metrics incosinstencies #11743

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

Closed
agamemnonc opened this issue Aug 3, 2018 · 4 comments
Closed

Classification metrics incosinstencies #11743

agamemnonc opened this issue Aug 3, 2018 · 4 comments

Comments

@agamemnonc
Copy link
Contributor

agamemnonc commented Aug 3, 2018

[This issue is related to #7332].

I think there is some inconsistency with the current classification metrics.

Let's consider the four following metrics:

  • accuracy_score
  • zero_one_loss
  • jaccard_similarity_score
  • hamming_loss

From my understanding, accuracy_score and zero_one_loss, represent exactly opposite things (i.e. there is a 1-to-1 relationship between the two), therefore they must always sum to 1. Makes sense.

Additionally, in the multi-label setting, both metrics are strict; that is, for a given sample the set of labels in y_pred must exactly match the corresponding set of labels in y_true for either metric to consider this sample as accurate.

Now, am I right in understanding that the hamming_loss is essentially the same as zero_one_loss, except that it is not strict in the multi-label setting, as in this case it penalises individual labels? In a single-label setting (either binary or multi-class, it doesn't matter) hamming_loss and zero_one_loss should be equivalent.

So far so good. Now, I would assume that with respect to hamming_loss, we would need a related accuracy metric which looks at the individual labels in the multi-label setting. In the case of a single-label setting (either binary or multi-class) this metric would be equivalent to accuracy_score. In other words, similarly to the pair accuracy_score - zero_one_loss we would have another pair some_new_accuracy_score - hamming_loss so that the latter two always sum up to one, in the same way that accuracy_score and zero_one_loss sum up to one (again, this would hold for multi-class and multi-label classification alike).

Instead we have the jaccard_similarity_score which is defined as the intersection over union -- are we sure this is what we really want?

Furthermore, I am not sure I understand why hamming_loss does not have a normalize input argument, in the same way that zero_one_loss, accuracy_score and jaccard_similarity_score do. Equally, why is hamming_loss the only metric supporting the classes (to be deprecated in favour of labels) input argument?

@agamemnonc agamemnonc changed the title Classification metrics incosinstency Classification metrics incosinstencies Aug 3, 2018
@jnothman
Copy link
Member

jnothman commented Aug 4, 2018 via email

@agamemnonc
Copy link
Contributor Author

agamemnonc commented Aug 6, 2018

Agreed with everything.

To clarify further, I believe it would be worth having an accuracy metric which in the multi-label setting, instead of computing subset accuracy which is a strict metric, would just compute the average accuracy across samples and labels.

One idea for this to be implemented would be to just include an additional input argument, say multilabel which could be one of subset or average or something along these lines. Do you think this would be incompatible with the current API design?

The reason I am making this point is not because I believe that we need a compliment/dyadic metric to hamming_loss, but because in some, but not all, applications this metric might actually be useful. I am currently working on an application where such a metric makes much more sense than the strict subset accuracy provided by accuracy_score. I know it is rather straightforward to implement this, but I reckon it would be worth providing it off-the-shelf.

@jnothman
Copy link
Member

jnothman commented Aug 6, 2018 via email

@agamemnonc
Copy link
Contributor Author

Agreed, but that's why I made the connection between zero_one_loss and accuracy_score in my first post. I mean, if we were to follow the same logic, then we wouldn't need accuracy_score since we already have zero_one_loss?

Anyway, please feel free to close the issue if you think this is not needed. (Although it might be worth opening a new one for fixing hamming_loss)

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