Skip to content

DOC Apply numpydoc validation to VotingRegressor methods #15969

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

Merged
merged 6 commits into from
Dec 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions sklearn/ensemble/_voting.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class VotingRegressor(RegressorMixin, _BaseVoting):

Parameters
----------
estimators : list of (string, estimator) tuples
estimators : list of (str, estimator) tuples
Invoking the ``fit`` method on the ``VotingRegressor`` will fit clones
of those original estimators that will be stored in the class attribute
``self.estimators_``. An estimator can be set to ``'drop'`` using
Expand Down Expand Up @@ -357,6 +357,10 @@ class VotingRegressor(RegressorMixin, _BaseVoting):

.. versionadded:: 0.20

See Also
--------
VotingClassifier: Soft Voting/Majority Rule classifier.

Examples
--------
>>> import numpy as np
Expand All @@ -370,10 +374,6 @@ class VotingRegressor(RegressorMixin, _BaseVoting):
>>> er = VotingRegressor([('lr', r1), ('rf', r2)])
>>> print(er.fit(X, y).predict(X))
[ 3.3 5.7 11.8 19.7 28. 40.3]

See also
--------
VotingClassifier: Soft Voting/Majority Rule classifier.
"""

def __init__(self, estimators, weights=None, n_jobs=None):
Expand All @@ -382,7 +382,7 @@ def __init__(self, estimators, weights=None, n_jobs=None):
self.n_jobs = n_jobs

def fit(self, X, y, sample_weight=None):
""" Fit the estimators.
"""Fit the estimators.

Parameters
----------
Expand All @@ -401,6 +401,7 @@ def fit(self, X, y, sample_weight=None):
Returns
-------
self : object
Fitted estimator.
"""
y = column_or_1d(y, warn=True)
return super().fit(X, y, sample_weight)
Expand Down Expand Up @@ -435,9 +436,8 @@ def transform(self, X):

Returns
-------
predictions
array-like of shape (n_samples, n_classifiers), being
values predicted by each regressor.
predictions: array of shape (n_samples, n_classifiers)
Values predicted by each regressor.
"""
check_is_fitted(self)
return self._predict(X)