8000 DOC Correctly docstring in StackingRegressor.fit_transform (#25599) · scikit-learn/scikit-learn@82f8ada · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 82f8ada

Browse files
thomasjpfanjeremiedbb
authored andcommitted
DOC Correctly docstring in StackingRegressor.fit_transform (#25599)
1 parent c069158 commit 82f8ada

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

sklearn/ensemble/_stacking.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,30 @@ def transform(self, X):
973973
"""
974974
return self._transform(X)
975975

976+
def fit_transform(self, X, y, sample_weight=None):
977+
"""Fit the estimators and return the predictions for X for each estimator.
978+
979+
Parameters
980+
----------
981+
X : {array-like, sparse matrix} of shape (n_samples, n_features)
982+
Training vectors, where `n_samples` is the number of samples and
983+
`n_features` is the number of features.
984+
985+
y : array-like of shape (n_samples,)
986+
Target values.
987+
988+
sample_weight : array-like of shape (n_samples,), default=None
989+
Sample weights. If None, then samples are equally weighted.
990+
Note that this is supported only if all underlying estimators
991+
support sample weights.
992+
993+
Returns
994+
-------
995+
y_preds : ndarray of shape (n_samples, n_estimators)
996+
Prediction outputs for each estimator.
997+
"""
998+
return super().fit_transform(X, y, sample_weight=sample_weight)
999+
9761000
def _sk_visual_block_(self):
9771001
# If final_estimator's default changes then this should be
9781002
# updated.

0 commit comments

Comments
 (0)
0