File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -541,6 +541,22 @@ class BaggingClassifier(ClassifierMixin, BaseBagging):
541
541
`oob_decision_function_` might contain NaN. This attribute exists
542
542
only when ``oob_score`` is True.
543
543
544
+ Examples
545
+ --------
546
+ >>> from sklearn.svm import SVC
547
+ >>> from sklearn.ensemble import BaggingClassifier
548
+ >>> from sklearn.datasets import make_classification
549
+ >>> X, y = make_classification(n_samples=1000, n_features=4,
550
+ ... n_informative=2, n_redundant=0,
551
+ ... random_state=0, shuffle=False)
552
+ >>> clf = BaggingClassifier(n_estimators=100, random_state=0).fit(X, y)
553
+ >>> clf.predict([[0, 0, 0, 0]])
554
+ array([1])
555
+ >>> clf = BaggingClassifier(base_estimator=SVC(),
556
+ ... n_estimators=100, random_state=0).fit(X, y)
557
+ >>> clf.predict([[0, 0, 0, 0]])
558
+ array([1])
559
+
544
560
References
545
561
----------
546
562
You can’t perform that action at this time.
0 commit comments