Skip to content

DOC - Ensure StackingClassifier pass numpydoc validation #21135

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 7 commits into from
Sep 27, 2021
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"SpectralCoclustering",
"SpectralEmbedding",
"SplineTransformer",
"StackingClassifier",
"StackingRegressor",
"TransformedTargetRegressor",
]
Expand Down
12 changes: 7 additions & 5 deletions sklearn/ensemble/_stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ class StackingClassifier(ClassifierMixin, _BaseStacking):
stack_method_ : list of str
The method used by each base estimator.

See Also
--------
StackingRegressor : Stack of estimators with a final regressor.

Notes
-----
When `predict_proba` is used by each estimator (i.e. most of the time for
Expand Down Expand Up @@ -424,7 +428,6 @@ class StackingClassifier(ClassifierMixin, _BaseStacking):
... )
>>> clf.fit(X_train, y_train).score(X_test, y_test)
0.9...

"""

def __init__(
Expand Down Expand Up @@ -477,6 +480,7 @@ def fit(self, X, y, sample_weight=None):
Returns
-------
self : object
Returns a fitted instance of estimator.
"""
check_classification_targets(y)
self._le = LabelEncoder().fit(y)
Expand Down Expand Up @@ -509,8 +513,7 @@ def predict(self, X, **predict_params):

@if_delegate_has_method(delegate="final_estimator_")
def predict_proba(self, X):
"""Predict class probabilities for X using
`final_estimator_.predict_proba`.
"""Predict class probabilities for `X` using the final estimator.

Parameters
----------
Expand All @@ -529,8 +532,7 @@ def predict_proba(self, X):

@if_delegate_has_method(delegate="final_estimator_")
def decision_function(self, X):
"""Predict decision function for samples in X using
`final_estimator_.decision_function`.
"""Decision function for samples in `X` using the final estimator.

Parameters
----------
Expand Down