Skip to content

Confusion error message with _check_clf_target in the metrics module #2137

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
arjoly opened this issue Jul 8, 2013 · 1 comment · Fixed by #2147
Closed

Confusion error message with _check_clf_target in the metrics module #2137

arjoly opened this issue Jul 8, 2013 · 1 comment · Fixed by #2147
Labels
Bug Easy Well-defined and straightforward way to resolve

Comments

@arjoly
Copy link
Member

arjoly commented Jul 8, 2013

import numpy as np
from sklearn.metrics.metrics import _check_clf_targets

y1 = np.array([[1, 0, 1, 0, 1], 
 [0, 0, 0, 1, 0],
 [0, 1, 0, 0, 1]])
y2 = np.array([[ 0.35,  0.5,   0.5,  0.5,   0.45],
 [ 0.2,   0.45,  0.2,   0.65,  0.3 ],
 [ 0.35,  0.5,   0.55,  0.3,   0.35]])

_check_clf_targets(y1, y2)

This code raise the following error message

----> 1 _check_clf_targets(y1, y2)

/Users/ajoly/git/scikit-learn/sklearn/metrics/metrics.pyc in _check_clf_targets(y_true, y_pred)
     69     if type_true.startswith('multilabel'):
     70         if not type_pred.startswith('multilabel'):
---> 71             raise ValueError("Can't handle mix of multilabel and multiclass "
     72                              "targets")
     73         if type_true != type_pred:

ValueError: Can't handle mix of multilabel and multiclass targets

Instead of saying that you are try to mix multialbel-indicator and multioutput-continous value. (ping @jnothman)
This _check_clf_targets is used for instance in accuracy_score.

@jnothman
Copy link
Member

jnothman commented Jul 9, 2013

Right. I guess I wrote that at a time I wasn't thinking about multioutput.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Easy Well-defined and straightforward way to resolve
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants