-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Add an example for ensemble.BaggingRegressor #15196
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
[MRG] Add an example for ensemble.BaggingRegressor #15196
Conversation
sklearn/ensemble/bagging.py
Outdated
... random_state=0, shuffle=False) | ||
>>> regr = BaggingRegressor(n_estimators=10, random_state=0).fit(X, y) | ||
>>> regr.predict([[0, 0, 0, 0]]) | ||
array([2.36503199]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array([2.36503199]) | |
array([2.3650...]) |
sklearn/ensemble/bagging.py
Outdated
>>> regr = BaggingRegressor(base_estimator=SVR(), | ||
... n_estimators=10, random_state=0).fit(X, y) | ||
>>> regr.predict([[0, 0, 0, 0]]) | ||
array([-2.87202411]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array([-2.87202411]) | |
array([-2.8720...]) |
sklearn/ensemble/bagging.py
Outdated
>>> regr = BaggingRegressor(n_estimators=10, random_state=0).fit(X, y) | ||
>>> regr.predict([[0, 0, 0, 0]]) | ||
array([2.36503199]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably don't need this part, I'm happy to have only the SVR
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I also removed the second one from the BaggingClassifier
example.
2d768b9
to
157b730
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @steinfurt
See also #3846
Implements a simple example/doctest for ensemble.BaggingRegressor and speeds up the test for ensemble.BaggingClassifier somewhat.
ping @adrinjalali