Skip to content
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] FIX use a stump as base estimator in RUSBoostClassifier #545

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use a stump as base estimator in RUSBoostClassifier
  • Loading branch information
chkoar committed Feb 15, 2019
commit 068560369ff8c79cab9ba7c8275a510f24142733
9 changes: 5 additions & 4 deletions imblearn/ensemble/_weight_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ class RUSBoostClassifier(AdaBoostClassifier):

Parameters
----------
base_estimator : object, optional (default=DecisionTreeClassifier)
base_estimator : object, optional (default=None)
The base estimator from which the boosted ensemble is built.
Support for sample weighting is required, as well as proper `classes_`
and `n_classes_` attributes.
Support for sample weighting is required, as well as proper
``classes_`` and ``n_classes_`` attributes. If ``None``, then
the base estimator is ``DecisionTreeClassifier(max_depth=1)``

n_estimators : integer, optional (default=50)
The maximum number of estimators at which boosting is terminated.
Expand Down Expand Up @@ -151,7 +152,7 @@ def fit(self, X, y, sample_weight=None):
super(RUSBoostClassifier, self).fit(X, y, sample_weight)
return self

def _validate_estimator(self, default=DecisionTreeClassifier()):
def _validate_estimator(self, default=DecisionTreeClassifier(max_depth=1)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you are right. We should actually call the parent class then:
https://github.com/scikit-learn/scikit-learn/blob/7389dba/sklearn/ensemble/weight_boosting.py#L414

"""Check the estimator and the n_estimator attribute, set the
`base_estimator_` attribute."""
if not isinstance(self.n_estimators, (numbers.Integral, np.integer)):
Expand Down