Skip to content

Commit

Permalink
Add tolerance for best_purity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDunnNZ committed Jun 5, 2020
1 parent 579062f commit 485231b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/classification/tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module treeclassifier
unsplittable = false
purity = -(nl * purity_function(ncl, nl)
+ nr * purity_function(ncr, nr))
if purity > best_purity
if purity > best_purity + 1e-12
# will take average at the end
threshold_lo = last_f
threshold_hi = curr_f
Expand Down
2 changes: 1 addition & 1 deletion src/regression/tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module treeregressor
if lo-1 >= min_samples_leaf && n_samples - (lo-1) >= min_samples_leaf
unsplittable = false
purity = (rsum * rsum / nr) + (lsum * lsum / nl)
if purity > best_purity
if purity > best_purity + 1e-12
# will take average at the end, if possible
threshold_lo = last_f
threshold_hi = curr_f
Expand Down

0 comments on commit 485231b

Please sign in to comment.