Skip to content

Commit 703cee1

Browse files
zerolfxglemaitre
andauthored
FIX default parameter value of min_samples_leaf in BalancedRandomForestClassifier (#711)
Co-authored-by: Guillaume Lemaitre <[email protected]>
1 parent ce9eb8b commit 703cee1

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

doc/whats_new/v0.7.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,17 @@ Version 0.7.0 (under development)
55

66
Changelog
77
---------
8+
9+
Changed models
10+
..............
11+
12+
The following models might give some different results due to changes:
13+
14+
- :class:`imblearn.ensemble.BalancedRandomForestClassifier`
15+
16+
Bug fixes
17+
.........
18+
19+
- Change the default value `min_samples_leaf` to be consistent with
20+
scikit-learn.
21+
:pr:`711` by :user:`zerolfx <zerolfx>`.

imblearn/ensemble/_forest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def __init__(
302302
criterion="gini",
303303
max_depth=None,
304304
min_samples_split=2,
305-
min_samples_leaf=2,
305+
min_samples_leaf=1,
306306
min_weight_fraction_leaf=0.0,
307307
max_features="auto",
308308
max_leaf_nodes=None,

imblearn/ensemble/tests/test_forest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def test_balanced_random_forest_oob(imbalanced_dataset):
116116
X, y, random_state=42, stratify=y
117117
)
118118
est = BalancedRandomForestClassifier(
119-
oob_score=True, random_state=0, n_estimators=1000
119+
oob_score=True, random_state=0, n_estimators=1000,
120+
min_samples_leaf=2,
120121
)
121122

122123
est.fit(X_train, y_train)

0 commit comments

Comments
 (0)