diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index e9ceca7fe0ea8..a01993b613d63 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -23,6 +23,11 @@ "RidgeClassifier.fit", "RidgeClassifierCV.decision_function", "SGDClassifier.decision_function", + "VotingRegressor$", + "VotingRegressor.fit", + "VotingRegressor.transform", + "VotingRegressor.predict", + "VotingRegressor.score", "KernelDensity", "KernelDensity.fit", "KernelDensity.score", diff --git a/sklearn/base.py b/sklearn/base.py index b4cedffd9dab3..16ef7324d856f 100644 --- a/sklearn/base.py +++ b/sklearn/base.py @@ -369,7 +369,7 @@ class RegressorMixin: _estimator_type = "regressor" def score(self, X, y, sample_weight=None): - """Returns the coefficient of determination R^2 of the prediction. + """Return the coefficient of determination R^2 of the prediction. The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total @@ -549,11 +549,13 @@ def fit_transform(self, X, y=None, **fit_params): y : numpy array of shape [n_samples] Target values. + **fit_params : Any number of parameters + Fit parameters. + Returns ------- X_new : numpy array of shape [n_samples, n_features_new] Transformed array. - """ # non-optimized default implementation; override when a better # method is possible for a given clustering algorithm diff --git a/sklearn/ensemble/_voting.py b/sklearn/ensemble/_voting.py index bddf5f00b10af..d1074c6b4b65d 100644 --- a/sklearn/ensemble/_voting.py +++ b/sklearn/ensemble/_voting.py @@ -328,7 +328,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 @@ -359,6 +359,10 @@ class VotingRegressor(RegressorMixin, _BaseVoting): .. versionadded:: 0.20 + See Also + -------- + VotingClassifier: Soft Voting/Majority Rule classifier. + Examples -------- >>> import numpy as np @@ -372,10 +376,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): @@ -384,7 +384,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 ---------- @@ -403,6 +403,7 @@ def fit(self, X, y, sample_weight=None): Returns ------- self : object + Returns self. """ y = column_or_1d(y, warn=True) return super().fit(X, y, sample_weight) @@ -438,7 +439,7 @@ def transform(self, X): Returns ------- predictions - array-like of shape (n_samples, n_classifiers), being + Array-like of shape (n_samples, n_classifiers), being values predicted by each regressor. """ check_is_fitted(self)