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

Skip to content

API add verbose flag for Voting* estimators - #15991

Closed
reshamas wants to merge 28 commits into
scikit-learn:masterfrom
reshamas:verbose_voting
Closed

API add verbose flag for Voting* estimators#15991
reshamas wants to merge 28 commits into
scikit-learn:masterfrom
reshamas:verbose_voting

Conversation

@reshamas

Copy link
Copy Markdown
Member

Reference Issues/PRs

References #11364
Closes #14772

What does this implement/fix? Explain your changes.

This PR adds a boolean verbose flag for the classes in voting.py. Adds function _log_message to _BaseVoting and uses code format as in #11364.

Any other comments?

Continuing work begun by @hannahbrucemacdonald and @spbail at NYC sprint (Aug 2019)

@reshamas

Copy link
Copy Markdown
Member Author

@jnothman @NicolasHug
There are lots of errors here, and I'm not sure where to begin.

cc: @cmarmo

@cmarmo

cmarmo commented Jan 1, 2020

Copy link
Copy Markdown
Contributor

@reshamas , I've tried to review this PR but it turns out there are a lot of things to change and I don't think I'm capable to guide you in making those changes... maybe the issue is less "Easy" than it was supposed to be... :)
If you don't mind I will propose a PR to your branch in the next days. Is that ok for you? Thanks!

@reshamas

reshamas commented Jan 1, 2020

Copy link
Copy Markdown
Member Author

@cmarmo
Sure, that works. I also know there is redundant code in there I need to fix. But, thought best to focus on the errors first.

@cmarmo

cmarmo commented Jan 1, 2020

Copy link
Copy Markdown
Contributor

Oh my... :( ... sorry @reshamas ... lint error...

sklearn/ensemble/tests/test_voting.py:516:1: E302 expected 2 blank lines, found 1
def test_voting_verbose_vc(capsys):
^
sklearn/ensemble/tests/test_voting.py:542:1: E302 expected 2 blank lines, found 1
def test_voting_verbose_vr(capsys):

Could you take care of that? Thanks!

@cmarmo

cmarmo commented Jan 2, 2020

Copy link
Copy Markdown
Contributor

@thomasjpfan , this PR heavily relies on your example (#11364). Could you take a look, please?
Sorry to all previous reviewers: the code probably have lost your previous comments as it was remodeled by different people. We will try to do better for next sprints. Thanks for your patience and collaboration.

@glemaitre glemaitre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple of comments

@@ -64,8 +64,12 @@ def fit(self, X, y, sample_weight=None):

self.estimators_ = Parallel(n_jobs=self.n_jobs)(
delayed(_parallel_fit_estimator)(clone(clf), X, y,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you put clone(clf), .... on the next line. It will give you some space to call self._log_message() on the same line).

Comment thread sklearn/ensemble/_voting.py Outdated
Comment thread sklearn/ensemble/_voting.py Outdated
check_is_fitted(self)
return self._predict(X)

def _log_message(self, name, idx, total):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the function is called in both Voting* estimator, we could move it in _BaseVoting avoiding to have repeated code in both Voting* classes?

check_no_attributes_set_in_init(estimator.__class__.__name__, estimator)


def test_voting_verbose_vc(capsys):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the 2 tests are really similar, I would advise making them general enough such that we can parametrize the test with a VotingClassifier and a VotingRegressor.

Comment thread doc/whats_new/v0.23.rst Outdated
Comment thread doc/whats_new/v0.23.rst
- |Enhancement| improve error message in :func:`utils.validation.column_or_1d`.
:pr:`15926` by :user:`Loïc Estève <lesteve>`.

Multiple modules

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are only in sklearn.ensemble

@glemaitre glemaitre changed the title add verbose flag for VotingClassifier and VotingRegressor API add verbose flag for Voting* estimators Jan 2, 2020
reshamas and others added 3 commits January 2, 2020 12:02
Co-Authored-By: Guillaume Lemaitre <[email protected]>
Co-Authored-By: Guillaume Lemaitre <[email protected]>
Co-Authored-By: Guillaume Lemaitre <[email protected]>
@jnothman

jnothman commented Jan 9, 2020

Copy link
Copy Markdown
Member

Closed by #16069

@jnothman jnothman closed this Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants