Skip to content

Conversation

mlewis1729
Copy link
Contributor

@mlewis1729 mlewis1729 commented May 25, 2017

Fixes #8933

Reference Issue

What does this implement/fix? Explain your changes.

Any other comments?

@mlewis1729 mlewis1729 changed the title fixed OOB_Score bug for bagging classifiers. [MRG] fixed OOB_Score bug for bagging classifiers. May 25, 2017
@mlewis1729 mlewis1729 changed the title [MRG] fixed OOB_Score bug for bagging classifiers. [WIP] fixed OOB_Score bug for bagging classifiers. May 25, 2017
@mlewis1729 mlewis1729 changed the title [WIP] fixed OOB_Score bug for bagging classifiers. [MRG] fixed OOB_Score bug for bagging classifiers. May 26, 2017
def test_set_oob_score():
# Make sure the oob_score doesn't change when the labels change
# See: https://github.com/scikit-learn/scikit-learn/issues/8933
N = 50
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a non-regression test, I don't see why this is any better than asserting that

BaggingClassifier(oob_score=True).fit([[0], [1]] * 5, ['A', 'B'] * 5).oob_score_

is approximately 1... or, at a minimum, not 0, which the current bug gives.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured testing a "failing" label integer set ([-1,0,1]), a "standard" label set ([0,1,2]), and an alphanumeric label set (['a','b,'c']) would sufficiently exhaustive. Whatever your preference.

assert_equal(bagging._max_samples, max_samples)


def test_set_oob_score():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps test_set_oob_score_label_encoding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change the test name to that if it's preferred

@jnothman
Copy link
Member

jnothman commented May 26, 2017 via email

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise lgtm

def test_set_oob_score_label_encoding():
# Make sure the oob_score doesn't change when the labels change
# See: https://github.com/scikit-learn/scikit-learn/issues/8933
randState = 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should avoid camel case for such variables

@jnothman jnothman changed the title [MRG] fixed OOB_Score bug for bagging classifiers. [MRG+1] fixed OOB_Score bug for bagging classifiers. May 27, 2017
@agramfort
Copy link
Member

I'll fix in master the CamelCase and add a what's new entry

thx @mlewis1729

@agramfort agramfort merged commit af41282 into scikit-learn:master Jun 8, 2017
@agramfort
Copy link
Member

see 6d2e9f2

Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
* fixed OOB_Score bug for bagging slassifiers.
See: scikit-learn#8933

* Added white space

* more white space fixing

* Adding test for oob_score validity

* removing pandas, replacing with numpy matrices

* fixing white space

* more white space fixing

* white space ...

* fixed labels to allow for strings

* white space

* simplifying test

* white space

* reformatting test

* white space

* pressed enter at end of file

* removing line at end of file
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

Successfully merging this pull request may close these issues.

BUG: BaggingClassifier.oob_score_ should not change with class label
3 participants