@@ -235,8 +235,7 @@ def __init__(
235
235
self .verbose = verbose
236
236
237
237
def fit (self , X , y , sample_weight = None ):
238
- """Build a Bagging ensemble of estimators from the training
239
- set (X, y).
238
+ """Build a Bagging ensemble of estimators from the training set (X, y).
240
239
241
240
Parameters
242
241
----------
@@ -256,6 +255,7 @@ def fit(self, X, y, sample_weight=None):
256
255
Returns
257
256
-------
258
257
self : object
258
+ Fitted estimator.
259
259
"""
260
260
return self ._fit (X , y , self .max_samples , sample_weight = sample_weight )<
8000
/div>
261
261
@@ -291,6 +291,7 @@ def _fit(self, X, y, max_samples=None, max_depth=None, sample_weight=None):
291
291
Returns
292
292
-------
293
293
self : object
294
+ Fitted estimator.
294
295
"""
295
296
random_state = check_random_state (self .random_state )
296
297
@@ -601,18 +602,9 @@ class BaggingClassifier(ClassifierMixin, BaseBagging):
601
602
`oob_decision_function_` might contain NaN. This attribute exists
602
603
only when ``oob_score`` is True.
603
604
604
- Examples
605
+ See Also
605
606
--------
606
- >>> from sklearn.svm import SVC
607
- >>> from sklearn.ensemble import BaggingClassifier
608
- >>> from sklearn.datasets import make_classification
609
- >>> X, y = make_classification(n_samples=100, n_features=4,
610
- ... n_informative=2, n_redundant=0,
611
<
8000
span class="diff-text-marker">- ... random_state=0, shuffle=False)
612
- >>> clf = BaggingClassifier(base_estimator=SVC(),
613
- ... n_estimators=10, random_state=0).fit(X, y)
614
- >>> clf.predict([[0, 0, 0, 0]])
615
- array([1])
607
+ BaggingRegressor : A Bagging regressor.
616
608
617
609
References
618
610
----------
@@ -629,6 +621,19 @@ class BaggingClassifier(ClassifierMixin, BaseBagging):
629
621
630
622
.. [4] G. Louppe and P. Geurts, "Ensembles on Random Patches", Machine
631
623
Learning and Knowledge Discovery in Databases, 346-361, 2012.
624
+
625
+ Examples
626
+ --------
627
+ >>> from sklearn.svm import SVC
628
+ >>> from sklearn.ensemble import BaggingClassifier
629
+ >>> from sklearn.datasets import make_classification
630
+ >>> X, y = make_classification(n_samples=100, n_features=4,
631
+ ... n_informative=2, n_redundant=0,
632
+ ... random_state=0, shuffle=False)
633
+ >>> clf = BaggingClassifier(base_estimator=SVC(),
634
+ ... n_estimators=10, random_state=0).fit(X, y)
635
+ >>> clf.predict([[0, 0, 0, 0]])
636
+ array([1])
632
637
"""
633
638
634
639
def __init__ (
@@ -862,7 +867,6 @@ def decision_function(self, X):
862
867
to the classes in sorted order, as they appear in the attribute
863
868
``classes_``. Regression and binary classification are special
864
869
cases with ``k == 1``, otherwise ``k==n_classes``.
865
-
866
870
"""
867
871
check_is_fitted (self )
868
872
0 commit comments