8000 remove extra parens and add whats new · scikit-learn/scikit-learn@35ed851 · GitHub
[go: up one dir, main page]

Skip to conte 8000 nt

Commit 35ed851

Browse files
committed
remove extra parens and add whats new
1 parent 57a5c44 commit 35ed851

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

doc/whats_new.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ New features
2020
Enhancements
2121
............
2222

23+
- Edited criterion for leaf nodes in decision tree criterion by declaring a
24+
node as a leaf if the weighted number of samples at the node is less than
25+
2 * the minimum weight specified to be at a node. This makes growth more
26+
efficient, but trees using parameters that modify the weight at each leaf
27+
will be grown differently. (`#7441
28+
<https://github.com/scikit-learn/scikit-learn/pull/7441>`_) by `Nelson
29+
Liu`_.
2330

2431
Bug fixes
2532
.........

sklearn/tree/_tree.pyx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ cdef class DepthFirstTreeBuilder(TreeBuilder):
216216
n_node_samples = end - start
217217
splitter.node_reset(start, end, &weighted_n_node_samples)
218218

219-
is_leaf = ((depth >= max_depth) or
220-
(n_node_samples < min_samples_split) or
221-
(n_node_samples < 2 * min_samples_leaf) or
222-
(weighted_n_node_samples < 2 * min_weight_leaf))
219+
is_leaf = (depth >= max_depth or
220+
n_node_samples < min_samples_split or
221+
n_node_samples < 2 * min_samples_leaf or
222+
weighted_n_node_samples < 2 * min_weight_leaf)
223223

224224
if first:
225225
impurity = splitter.node_impurity()
@@ -436,11 +436,11 @@ cdef class BestFirstTreeBuilder(TreeBuilder):
436436
impurity = splitter.node_impurity()
437437

438438
n_node_samples = end - start
439-
is_leaf = ((depth > self.max_depth) or
440-
(n_node_samples < self.min_samples_split) or
441-
(n_node_samples < 2 * self.min_samples_leaf) or
442-
(weighted_n_node_samples < 2 * self.min_weight_leaf) or
443-
(impurity <= min_impurity_split))
439+
is_leaf = (depth > self.max_depth or
440+
n_node_samples < self.min_samples_split or
441+
n_node_samples < 2 * self.min_samples_leaf or
442+
weighted_n_node_samples < 2 * self.min_weight_leaf or
443+
impurity <= min_impurity_split)
444444

445445
if not is_leaf:
446446
splitter.node_split(impurity, &split, &n_constant_features)

0 commit comments

Comments
 (0)
0