[MRG+1] ENH + DOC set a default scorer in the multiclass module #3444

Merged
merged 2 commits into from Jul 19, 2014

Projects

None yet

4 participants

@arjoly
Member
arjoly commented Jul 19, 2014

follow the discussion at the sprint
and intend to fix #1979

@arjoly
Member
arjoly commented Jul 19, 2014

great negative line count !!!

@kastnerkyle kastnerkyle commented on an outdated diff Jul 19, 2014
sklearn/base.py
@@ -270,12 +270,16 @@ class ClassifierMixin(object):
def score(self, X, y, sample_weight=None):
"""Returns the mean accuracy on the given test data and labels.
+ In multi-label classification, this is the subset accuracy
+ which is a harsh metric since you require for each samples that
@kastnerkyle
kastnerkyle Jul 19, 2014 Member

samples -> sample

@kastnerkyle
Member

As long as things pass this seems solid to me 👍

@coveralls

Coverage Status

Coverage increased (+0.0%) when pulling 16870ff on arjoly:explain-default-score into 0807e19 on scikit-learn:master.

@GaelVaroquaux GaelVaroquaux and 1 other commented on an outdated diff Jul 19, 2014
sklearn/base.py
Parameters
----------
X : array-like, shape = (n_samples, n_features)
Test samples.
- y : array-like, shape = (n_samples,)
+ y : array-like, shape = (n_samples, n_labels)
True labels for X.
@GaelVaroquaux
GaelVaroquaux Jul 19, 2014 Member

I think that here you have to have a "shape = (n_samples, ) or shape ) (n_samples, n_labels)" and to explain that n_labels is defined only in the multilabel case (I am thinking that people who don't have multilabel problems have no clue what this means, and will be a bit surprised.

@arjoly
arjoly Jul 19, 2014 Member

Would it work with n_outputs?

@GaelVaroquaux GaelVaroquaux commented on an outdated diff Jul 19, 2014
sklearn/base.py
@@ -308,7 +312,7 @@ def score(self, X, y, sample_weight=None):
X : array-like, shape = (n_samples, n_features)
Test samples.
- y : array-like, shape = (n_samples,)
+ y : array-like, shape = (n_samples, n_outputs)
@GaelVaroquaux
GaelVaroquaux Jul 19, 2014 Member

Same remark here.

@GaelVaroquaux
Member

👍 for merge

@arjoly arjoly changed the title from ENH + DOC set a default scorer in the multiclass module to [MRG+1] ENH + DOC set a default scorer in the multiclass module Jul 19, 2014
@GaelVaroquaux
Member

👍 for merge. Thanks!

@GaelVaroquaux
Member

2 👍. Merging.

@GaelVaroquaux GaelVaroquaux merged commit 4ec8630 into scikit-learn:master Jul 19, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@arjoly arjoly deleted the arjoly:explain-default-score branch Jul 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment