8000 [MRG + 1] Set min_impurity_split in gradient boosting models by sebp · Pull Request #8007 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG + 1] Set min_impurity_split in gradient boosting models #8007

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

Merged
merged 1 commit into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ Bug fixes
when a numpy array is passed in for weights. :issue:`7983` by
:user:`Vincent Pham <vincentpham1991>`.

- Fix a bug where :class:`sklearn.ensemble.GradientBoostingClassifier` and
:class:`sklearn.ensemble.GradientBoostingRegressor` ignored the
``min_impurity_split`` parameter.
:issue:`8006` by :user:`Sebastian Pölsterl <sebp>`.

API changes summary
-------------------

Expand All @@ -127,7 +132,6 @@ API changes summary
now only have ``self.estimators_`` available after ``fit``.
:issue:`7464` by `Lars Buitinck`_ and `Loic Esteve`_.


.. _changes_0_18_1:

Version 0.18.1
Expand Down
1 change: 1 addition & 0 deletions sklearn/ensemble/gradient_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ def _fit_stage(self, i, X, y, y_pred, sample_weight, sample_mask,
min_samples_split=self.min_samples_split,
min_samples_leaf=self.min_samples_leaf,
min_weight_fraction_leaf=self.min_weight_fraction_leaf,
min_impurity_split=self.min_impurity_split,
max_features=self.max_features,
max_leaf_nodes=self.max_leaf_nodes,
random_state=random_state,
Expand Down
13 changes: 13 additions & 0 deletions sklearn/ensemble/tests/test_gradient_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,19 @@ def test_max_leaf_nodes_max_depth():
assert_equal(tree.max_depth, 1)


def test_min_impurity_split():
# Test if min_impurity_split of base estimators is set
# Regression test for #8006
X, y = datasets.make_hastie_10_2(n_samples=100, random_state=1)
all_estimators = [GradientBoostingRegressor,
GradientBoostingClassifier]

for GBEstimator in all_estimators:
est = GBEstimator(min_impurity_split=0.1).fit(X, y)
for tree in est.estimators_.flat:
assert_equal(tree.min_impurity_split, 0.1)


def test_warm_start_wo_nestimators_change():
# Test if warm_start does nothing if n_estimators is not changed.
# Regression test for #3513.
Expand Down
0